#P1928. 外星密码

外星密码

Description

Even with a protective umbrella, the 2012 disaster cannot be completely avoided. The Earth Defense Squad decides to seek help from an alien species. After a long effort, the squad finally receives a reply from extraterrestrial life. However, what the aliens send is a string of cipher. Only by cracking the cipher can we know their exact response. The first step in cracking is to decompress the cipher: for several consecutive identical substrings X\texttt{X}, the aliens compress them into the form [DX]\texttt{[DX]} (DD is an integer and 1D991\leq D\leq99). For example, the string CBCBCBCB\texttt{CBCBCBCB} is compressed to [4CB]\texttt{[4CB]} or [2[2CB]]\texttt{[2[2CB]]}. The latter, where a compressed result is compressed again, is called double compression. If it is [2[2[2CB]]]\texttt{[2[2[2CB]]]}, that is triple compression. Now we give you the cipher sent by the aliens; please decompress it.

Input Format

Input one line containing a string that represents the cipher sent by the aliens.

Output Format

Output one line containing the decompressed string.

AC[3FUN]
ACFUNFUNFUN

Hint

Constraints

  • For 50% of the testdata: the length of the decompressed string is at most 1000, and there are at most three levels of compression.
  • For 100% of the testdata: the length of the decompressed string is at most 20000, and there are at most ten levels of compression. It is guaranteed that the input contains only digits, uppercase letters, [ and ].

Translated by ChatGPT 5