+ 6
Challenge string compression
Write a method that compress a string by the counts of consecutive chars. For example : aaabbbbccd - > a3b4c2d You can assume the string contains only letters. Have fun!
12 Answers
+ 15
+ 11
@nitzan
Do you mean on consecutive repeating characters?
For example, what is output for : "aaabbcddddad"?
Output 1: a3b2cd4ad
Output 2: a4b2cd5
+ 7
+ 4
It counts any character.
https://code.sololearn.com/cKd9YSs37Q03/#c
+ 3
Yes I mean consecutive
+ 2
https://code.sololearn.com/chs3l5N0ocxz/?ref=app
+ 2
+ 1
Didn't see that