Here is the translation of the programming task text from Russian to English: String compression with recovery by repetition rule

Go Hard strings

Task «Here is the translation of the programming task text from Russian to English: String compression with recovery by repetition rule»

Given a string consisting of Latin alphabet letters (a-z) and digits (0-9). The string is encoded according to the following rule: each group of characters followed by a number indicates that this group should be repeated the specified number of times. For example, 'ab3c2' means 'abababcc'. A group can be either a single character or a sequence of characters enclosed in square brackets. If the group does not contain brackets, the number refers to the last character. If the number is absent, the repetition is considered to be 1. It is necessary to write a program that takes an encoded string and outputs the decoded string. The length of the decoded string does not exceed 10^6 characters.

Input Format

One line containing an encoded sequence. The length of the string does not exceed 1000 characters.

Output Format

One line — the decoded sequence.

Examples

Example 1

INPUT
x2y3z
OUTPUT
xxyyyz

Example 2

INPUT
a2b[cd]3e
OUTPUT
aabcdcdcde

Example 3

INPUT
5 1 null root 10 2 1 child1 5 3 1 child2 7 4 2 grandchild 3 5 3 another 2
OUTPUT
main.go