15084 - String decompress   

Description

Capybara is a system engineer who needs to process a massive volume of packets from the server daily.
To reduce network bandwidth consumption, the server uses a specialized text compression format:

 

[S]N

 

This means the content inside the brackets is repeated times.

For example:

[abc]3

Will be decompressed as:

abcabcabc

Brackets can also be nested. For example:

A[b[12]2]3C

Will be decompressed as:

Ab1212b1212b1212C

Today, Capybara needs to fully restore the packet data.
However, he faces some problems, he doesn't know how to decompress it back. He then asked his friend, CABI-bara, CABI-bara also had no idea, but he knew that our I2P students are brillant, so he decided to make it a homework assignment, letting every I2P students to slove it for them.

Given a compressed string, please output the fully decompressed string.

Compression rules

  • [S]N means is repeated times, where is a positive integer.
  • Each ] is immediately followed by at least one digit, representing the number of repetitions.
  • The repetitoin count can be a multi-digit number.
  • Brackets can be nested.
  • The string can contain uppercase/lowercase English letters, digits, and printable characters. However, [ and ] are strictly used for the compression syntax.
  • It is guaranteed that the input format is valid.

Input

The input contains only one line, which is a valid compressed string.

  •  
  •  
  •  
  •  

Output

Output a single line containing the fully decompressed string.

Sample Input  Download

Sample Output  Download

Tags




Discuss