#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 , the aliens compress them into the form ( is an integer and ). For example, the string is compressed to or . The latter, where a compressed result is compressed again, is called double compression. If it is , 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
京公网安备 11011102002149号