164 views
String compression function with repeated characters
Task condition
You need to write a function that compresses a string by replacing consecutive identical characters with the character and the number of its repetitions, without adding extra signs.
//There is a string with many repeating letters:
//AAAAABBBCCXUZDDDDEEFFFFAAAAAABBBBBBBBBBBBBBBBBBBBBB
//It needs to be shortened so that it looks like this:
//A4B3C2XYZD4E3F3AGB28