P1928 Alien Cipher

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 $\texttt{X}$, the aliens compress them into the form $\texttt{[DX]}$ ($D$ is an integer and $1\leq D\leq99$). For example, the string $\texttt{CBCBCBCB}$ is compressed to $\texttt{[4CB]}$ or $\texttt{[2[2CB]]}$. The latter, where a compressed result is compressed again, is called double compression. If it is $\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.

Explanation/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