Consider the language defined below. An expression in this language is one of the following two forms.
The flattening of an expression is defined as follows.
In other words, if $f(e)$ is the flattening of $e$ and $+$ denotes concatenation, then $f\big((e_1\ e_2\ \cdots\ e_t\ n)\big)$ is:
$$ \underbrace{f(e_1)+f(e_2)+\cdots+f(e_t)}{1} + \underbrace{f(e_1)+f(e_2)+\cdots+f(e_t)}{2} + \cdots + \underbrace{f(e_1)+f(e_2)+\cdots+f(e_t)}_{n} $$
The table below shows some sample expressions and the result of flattening each.
| expression | flattening |
|---|---|
w | w |
(c 4) | cccc |
(a (b c 2) 3) | abcbcabcbcabcbc |
Write a program that flattens a given expression.
The input consists of one or more test cases. Each test case is a single, grammatically correct expression, and a $ character marks the end of that expression. The last line of the input is not a test case: it consists of a single $ character (possibly with leading and/or trailing whitespace).
Every expression in the input is grammatically correct according to the grammar above. An expression may contain leading, trailing, and/or embedded spaces, and all such spaces must be ignored. Letters and numbers are separated from one another by at least one space character.
For each test case expression, print its flattening on its own line. The output must contain no spaces other than newlines.