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.
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).
For each case, print the Beiju text on the screen.
This_is_a_[Beiju]_text word[hi,_ddc---]-ld[||hello
BeijuThis_is_a__text hello,_world
本題為多筆輸入,每行獨立處理。
vector, list 的費時,相差高達 374.07
倍!!八分五十一秒,我都快睡著惹。
相對地,list 的記憶體用量 137964 KB
為 vector 的 11 倍。以空間換取時間,非常划算喇!!
ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |