#K77857. Decode String

    ID: 34957 Type: Default 1000ms 256MiB

Decode String

Decode String

Given an encoded string s, return its decoded string.

The encoding rule is defined as: \( k[encoded\_string] \), where the encoded_string inside the square brackets is repeated exactly \( k \) times. Here, \( k \) is a positive integer. Nested encodings are possible.

Example:

  • Input: 3[a]2[bc] → Output: aaabcbc
  • Input: 3[a2[c]] → Output: accaccacc

Implement the solution so that it reads input from stdin and writes the result to stdout.

inputFormat

The input consists of a single line that contains the encoded string s.

You may assume the input string is non-empty and contains only valid characters.

outputFormat

Output the decoded string to stdout.

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