Log in
← All problems

Compress a string

mediumStrings20 XP

Replace each run of the same character by the character and the length of the run: "aaabcc" becomes "a3b1c2".

Examples

Examples use JSON: true/false/null are True/False/None in Python.

Run examples checks the examples above. Submit also runs 3 hidden tests.