#K11476. String Decoding

    ID: 23477 Type: Default 1000ms 256MiB

String Decoding

String Decoding

You are given an encoded string where the encoding rule is:

\( k[encoded\_string] \)

This means that the encoded_string inside the square brackets is repeated exactly k times. You can assume that the input string is always valid; there are no extra white spaces, and the square brackets are well-formed.

Your task is to decode the given encoded strings.

Example 1:
Input: "3[a]2[bc]"
Output: "aaabcbc"

Example 2:
Input: "3[a2[c]]"
Output: "accaccacc"

inputFormat

The first line of input contains a single integer T representing the number of encoded strings. The following T lines each contain one encoded string.

You should read input from stdin.

outputFormat

For each encoded string, output the decoded string on a new line. Print the result to stdout.

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

</p>