Steve came up with a way to compress text, though the text does not always get shorter. Steve works on single words only, and defines a "compressed word" with these rules.
A compressed word of one character is the same as the uncompressed word. To uncompress (e1 e2 … et n), uncompress each ei, concatenate those uncompressed words in order into a new word, then concatenate that new word n times. For example:
x uncompresses to x,(t 3) uncompresses to ttt,(a (b c 2) 3) uncompresses to abcbcabcbcabcbc.Write a program that uncompresses a compressed word.
The input holds one or more test cases. Each test case is one correctly formed compressed word on a line of its own. A $ character marks the end of a line. The last line of the input contains a single $, possibly with leading or trailing spaces, and it is not a test case. Every compressed word in the input follows the rules above. A compressed word may contain leading, trailing, or embedded spaces, and those spaces are ignored. Letters and numbers are separated from each other by at least one space character.
For each test case, print the uncompressed word on a line of its own. The output must contain no spaces other than the line breaks. An uncompressed word can be empty, and an empty word is printed as an empty line.