Decoding chains with repetitions
Python
Hard
strings
Task «Decoding chains with repetitions»
Given an encoded string consisting of Latin alphabet letters (a-z) and digits (0-9). The encoding follows the rule: if a letter is followed by a number, that letter is repeated the specified number of times. If there is no number, the letter is counted once. Numbers can be multi-digit. It is necessary to decode the string and output the result. The length of the original string does not exceed 10^5, the length of the decoded string can be up to 10^9, so the entire string cannot be stored in memory. The result must be output in parts, without storing it entirely.
Input Format
One line containing an encoded sequence.
Output Format
Decoded string (output in its entirety, but must not be stored in memory in its entirety).
Examples
Example 1
INPUT
x10y
OUTPUT
xxxxxxxxxxy
Example 2
INPUT
z
OUTPUT
z
main.py