Problem list
Log in
#r03346 · Online Judge > GoldOJ

Run-Length Encoding

Bronze II 2.0 s 256 MB

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
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code