b031: Broken Keyboard cont.
Tags : list string
Accepted rate : 2人/8人 ( 25% ) [非即時]
評分方式:
Tolerant

最近更新 : 2020-04-19 20:33

Content

本題為 UVA 11988 - Broken Keyboard (a.k.a. Beiju Text) 之修改。

 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
測資資訊:
記憶體限制: 256 MB
公開 測資點#0 (1%): 1.0s , <1M
公開 測資點#1 (99%): 1.0s , <50M
Hint :

本題為多筆輸入,每行獨立處理。

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

cont.

相對地,list 的記憶體用量 137964 KB 為 vector 的 11 倍。以空間換取時間,非常划算喇!!

Tags:
list string
出處:
UVA 11988 cont. [管理者:
nevikw39 ($\mathscr{nevikw}\pmb{39}\in\mathbf{37}^{th}$)
]


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