#K176. Decode String

    ID: 24586 Type: Default 1000ms 256MiB

Decode String

Decode String

Given an encoded string, return its decoded string. The encoding rule is defined as follows:

\( k [\text{encoded ext{-}string} ] \)

where the encoded-string inside the square brackets is repeated exactly k times. For example, the string 3[a]2[bc] should be decoded as aaabcbc.

Note that the encoded string may be nested, e.g. 3[a2[c]] should be decoded as accaccacc. It is recommended to use a stack or a recursive approach to solve this problem.

inputFormat

The input consists of a single line containing the encoded string. The string consists of digits, letters, and square brackets.

outputFormat

Output a single line containing the decoded string.

## sample
3[a]2[bc]
aaabcbc