Problem E

Benni was browsing the web and accidentally picked up a keylogger. Fortunately, Benni’s computer has virus protection which alerted him, but the protection did not remove the virus. When Benni types a password on a web page, he tries to hide it so that the keylogger does not get his password. In order to obscure his password, he enters it in a strange way. He uses the left and right arrow keys to move the cursor, and erases characters with backspace. If you are given the sequence of keystrokes that Benni used to enter his password, can you figure out what his password is?


The input is one line containing a string of length $n$. Benni only writes lowercase letters and digits, but when he presses the left arrow key, the right arrow key, or the backspace key, they are indicated by L, R, or B, respectively. Neither B nor L appear in the string if the cursor is in front of the first letter and R does not appear if the cursor is after the last letter.


Print one line containing only Benni’s password.







$1 \leq n \leq 1\, 000\, 000$, neither L, R, nor B are in the string



$1 \leq n \leq 1\, 000$



$1 \leq n \leq 1\, 000\, 000$, neither L nor R are in the string



$1 \leq n \leq 1\, 000\, 000$, B is not in the string



$1 \leq n \leq 1\, 000\, 000$

Sample Input 1 Sample Output 1
Sample Input 2 Sample Output 2
Sample Input 3 Sample Output 3
CPU Time limit 1 second
Memory limit 1024 MB
Statistics Show
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in