LogiQuest

202. Decode String

MediumStackParsing

Decode strings like 3[a2[c]] → accaccacc: k[s] means s repeated k times. Brackets can be nested.

Input format

A single encoded line.

Output format

The decoded string.

Example 1

Input

3[a]2[bc]

Output

aaabcbc

Example 2

Input

3[a2[c]]

Output

accaccacc

Constraints

Decoded length ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…