StackStringRecursion
An encoded string follows the rule k[text], meaning the text inside the brackets is repeated exactly k times. Encodings can be nested. Decode the string.
Input
A single line containing the encoded string (lowercase letters, digits and square brackets).
Output
Print the decoded string.
Constraints
1 <= length <= 100 The input is valid. Every number k is a positive integer, and the decoded length is at most 10^5.
Example 1
Input
3[a]2[bc]
Output
aaabcbc
aaa followed by bcbc.
Example 2
Input
3[a2[c]]
Output
accaccacc
The inner 2[c] becomes cc, so the outer repeats acc three times.