Problem 225
Expand Run-Length Encoding
Easy · 10 pts · String
Problem
A string was compressed with run-length encoding: each run of a repeated letter was written as the letter followed by the length of the run, as in a3b1c2. Decode it back into the original string. Read the encoded string from left to right: take a letter, then read all the digits that follow it as one number (a count can have several digits, as in a12), and append the letter that many times.
Input
A single encoded string: lowercase letters each followed by a positive integer.
Output
Print the decoded string.
Constraints
1 <= encoded length <= 1000; the decoded length is at most 100000
Example input
a3b1c2
Example output
aaabcc
Explanation
"a3b1c2" means a three times, b once and c twice. Decoded, that is aaa + b + cc = aaabcc.