Question: answer the following question in c++. thnx String Compression [10 points) A simple compression algorithm is to replace repeated sequences of a character with the
answer the following question in c++. thnx

String Compression [10 points) A simple compression algorithm is to replace repeated sequences of a character with the character written once followed by the number of times it repeats. For example the string "AAACTGG" can be compressed as "A3CTG2". Since there are 3 As at the beginning, we have A3, then there is only 1 C, so we just write "C", not "CI" because that would take more space. Same idea behind "T", and finally, we have "GG" which is the same as "G2". Write a function in your header file with the following signature: std::string compress ( std::string) which takes in a string and returns its compression
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
