#K11131. Decode Encoded String
Decode Encoded String
Decode Encoded String
This problem requires you to decode an encoded string following a specific encoding rule. The rule is defined as follows:
\( k[encoded\_string] \)
Here, the encoded_string inside the square brackets is repeated exactly k times, where \( k \) is a positive integer. Every pair of square brackets is guaranteed to be well-formed. For example:
- Input:
3[a]2[bc]
— Output:aaabcbc
- Input:
3[a2[c]]
— Output:accaccacc
- Input:
2[abc]3[cd]ef
— Output:abcabccdcdcdef
Your task is to write a program that reads an encoded string from stdin and prints the decoded string to stdout.
inputFormat
The input consists of a single line containing the encoded string. The string will include digits, letters, and square brackets in a well-formed fashion.
outputFormat
Output the decoded string on a single line.
## sample3[a]2[bc]
aaabcbc