~/algor $ cat problems/stack-ichma-ich-siqilgan-satr
Decoding a nested compressed string
Medium
1000 ms
128 MB
56%
A string is given in compressed form: k[t] means the string $t$ written $k$ times in a row, and $t$ itself may also be compressed (for example, 3[a2[c]]b is accaccaccb). Restore the original string.
Input
One line with the compressed string.
Output
The original string.
Note
the length of the compressed string is at most $10^{4}$, the length of the original string is at most $10^{5}$
the string contains lowercase Latin letters, digits and square brackets; every [ is preceded by a number from $1$ to $99$ (without a leading zero), and the brackets are never empty
Examples
Input #1
3[a2[c]]b
Output #1
accaccaccb
Input #2
2[ab]3[c]
Output #2
ababccc