Hide

Problem F
Keystrokes

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?

Input

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.

Output

Print one line containing only Benni’s password.

Scoring

Group

Points

Constraints

$1$

$10$

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

$2$

$13$

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

$3$

$17$

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

$4$

$24$

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

$5$

$36$

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

Sample Input 1 Sample Output 1
iLnLnLeLb
benni
Sample Input 2 Sample Output 2
arnarLLLBBun
unnar
Sample Input 3 Sample Output 3
password123
password123
CPU Time limit 1 second
Memory limit 1024 MB
Authors
Arnar Bjarni Arnarson and Óðinn Eyjólfsson
Source Forritunarkeppni Framhaldsskólanna 2018
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in