GUVI
Back

Modern keyboard

Created 2 years ago
25 Views
1 Comments
Subham7TC2Ke
@Subham7TC2Ke
Subham7TC2Ke
@Subham7TC2KeProfile is locked. Login

Jack has built his own keyboard. He loves the binary number system so he decides to include only the binary digit, \(\{0, 1\}\) and for erasing he also decided to add backspace in the keyboard. Therefore the keys on the keyboard are \(\{0, 1, B\}\) where \(B\) denotes the backspace character. He opens the editor and starts typing the characters. He starts with an empty string. When each key on the keyboard is pressed, the following changes occur to the string: 0 Key: a letter 0 will be inserted to the right of the string. 1 Key: a letter 1 will be inserted to the right of the string. B Key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted. Jack has launched the editor and pressed these keys several times. You are given a string s, which is a record of his keystrokes in order. Help Jack to find out what string is displayed in the editor now?

INPUT: The first and only line of input contains a single string \(s\) denoting the operations performed by Jack. \((1 \le |s| \le 10^4)\). \(s\) consist of characters \(\{0, 1, B\}\).

OUTPUT: Print a single string denoting the resulting string after keystrokes.

Sample input

Sample output

01B0

00

Explanation of Sample I/O

Each time the key is pressed, the string in the editor will change as follows:\(0, 01, 0, 00.\)

Comments
Please login to comment.
 
Powered by habitate.io Habitate