b031: Broken Keyboard cont.
Tags :
Accepted rate : 2人/8人 ( 25% ) [非即時]

Content

You're typing a long text with a broken keyboard. Well it's not so badly broken. The only problem with the keyboard is that sometimes the "home" key or the "end" key gets automatically pressed (internally).

Furthermore, "Backspace" and "Delete" also get triggered unknowingly from time to time.

You're not aware of this issue, since you're focusing on the text and did not even turn on the monitor! After you finished typing, you can see a text on the screen (if you turn on the monitor). In Chinese, we can call it Beiju. Your task is to find the Beiju text.

Input

There are several test cases. Each test case is a single line containing at least one and at most $10,000,000$ letters, underscores and two special characters '[' and ']'. '[' means the "Home" key is pressed internally, and ']' means the "End" key is pressed internally. In addittion, '-' represents  "Backspace" key down while '|' indicates  "Delete" key being triggered. The input is terminated by end-of-file (EOF).

Output

For each case, print the Beiju text on the screen.

Sample Input #1
This_is_a_[Beiju]_text
word[hi,_ddc---]-ld[||hello
Sample Output #1
BeijuThis_is_a__text
hello,_world

Hint ：

vector, list 的費時，相差高達 374.07 倍！！八分五十一秒，我都快睡著惹。

### cont.

Tags:

[管理者：
($\mathscr{nevikw}\pmb{39}\in\mathbf{37}^{th}$)
]

 ID User Problem Subject Hit Post Date 沒有發現任何「解題報告」