#K65597. Decode the Encoded Message
Decode the Encoded Message
Decode the Encoded Message
You are given an encoded string that follows a specific pattern. The string contains groups of digits followed immediately by a lowercase letter. Each group represents that the letter should be repeated as many times as the number indicates.
For example, the encoded string 3a3b2c1d2a
should be decoded into aaabbbccdaa
because the group 3a
means 'a' is repeated 3 times; 3b
means 'b' is repeated 3 times; and so on.
More formally, if the encoded string is represented by a sequence of pairs \( (n, c) \), the output string is defined as:
\( \text{output} = \underbrace{c\,c\,\dots\,c}_{n \text{ times}} \) for each pair.
Your task is to decode the given string and output the original message.
inputFormat
The input consists of a single line containing the encoded string. The encoded string is non-empty and follows the pattern where one or more digits (representing a positive integer) are immediately followed by a single lowercase letter.
outputFormat
Output the decoded string which is the original message. The output should be printed on stdout.
## sample3a3b2c1d2a
aaabbbccdaa