Run-Length Scroll (Strings)

Compress a line of letters with run-length encoding: aaabcc becomes a3b1c2.

Input: One line of letters.

Output: The encoded string.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Walk the string and count repeats of the current character.

More Strings practice