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
- Input: s = "aaabcc"Output: "a3b1c2"
- Input: s = ""Output: ""
Examples use JSON: true/false/null are True/False/None in Python.