topic description
- In order to improve the efficiency of data transmission, the transmitted packets are compressed.
- Input a compressed message, please return its decompressed original message.
- Compression rule: n[str], means that the str inside the square brackets is repeated exactly n times.
- Note that n is a positive integer (0 < n <= 100), and str only contains lowercase English letters, regardless of abnormal conditions.
enter description
Enter the compressed message:
1) Regardless of invalid input, the message has no extra spaces, and the square brackets always meet the format requirements;
2) The original message does not contain numbers, and all numbers only represent the number of repetitions n, for example, there will be no input like 5b or 3[8];
output description
Original message after decompression
Note: The length of the original message will not exceed 1000, regardless of the abnormal situation
ACM input and output mode
If you often use Leetcode , you will know that letcode does not need to write input and output functions. However, the Huawei OD machine test uses the ACM mode , which requires manual programming of input and output.
So it is best to familiarize yourself with this mode in advance on Niu-ke. For example, C++ is used cin/cout
, and python is used input()/print()
. JavaScript uses node's readline()
andcons