Compress an uppercase string by run-length encoding: replace each maximal run of a repeated character with the character followed by the run length (lengths of $1$ are written explicitly). For example AAAAABBBCC becomes A5B3C2.
Input
One uppercase string of length $1$ to $1000$.
Output
Print the run-length-encoded string.
Example 1
Input
AAAAABBBCC
Output
A5B3C2
Example 2
Input
ABCDE
Output
A1B1C1D1E1
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.