Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key.
To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is empty. When each key on the keyboard is pressed, the following changes occur to the string:
 - The 0 key: a letter 0 will be inserted to the right of the string.
 - The 1 key: a letter 1 will be inserted to the right of the string.
 - The backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted.
Sig 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. In this string, the letter 0 stands for the 0 key, the letter 1 stands for the 1 key and the letter B stands for the backspace key. What string is displayed in the editor now?

-----Constraints-----
 - 1 ≦ |s| ≦ 10 (|s| denotes the length of s)
 - s consists of the letters 0, 1 and B.
 - The correct answer is not an empty string.

-----Input-----
The input is given from Standard Input in the following format:
s

-----Output-----
Print the string displayed in the editor in the end.

-----Sample Input-----
01B0

-----Sample Output-----
00

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

Difficulty: introductory

Starter code:

Solutions:
from collections import deque

S = input()

ans = deque([])

for s in S:
    if s=="B":
        if ans:
            ans.pop()
    else:
        ans.append(s)
        
print("".join(ans))

a = list(input())

b = []

for i in range(int(len(a))):
	t = a[int(i)]
	if t == "0":
		b.append("0")
	elif t == "1":
		b.append("1")
	else :
		if len(b) > 0:
			del b[-1]
print("".join(b))

s = input()
n = len(s)

ans = []
for i in range(n):
  if s[i] == "0":
    ans.append("0")
  elif s[i] == "1":
    ans.append("1")
  else:
    if ans:
      ans.pop()
      
print("".join(ans))

# Sの入力受付
S = input()
# Sを順に読み込みBがあったとき直前の文字と一緒に消去
STR = ""
for i in S:
    STR = STR + i
    if i == "B" and STR == "":
        STR = ""
    elif i == "B":
        STR = STR[:len(STR) - 2]
print(STR)


s = input()

ans = ''
for i in range(len(s)):
    if s[i] == 'B':
        ans = ans[:-1]
    else:
        ans += s[i]

print(ans)

S = input()

stack = []

for s in S:
    if not stack and s!="B":
        stack.append(s)
    elif s=="B":
        if stack:stack.pop()
        else:continue
    else:
        stack.append(s)
print("".join(stack))

binaryKeyboard = list(input())
ans = []

for i in binaryKeyboard:
    if i=='0' or i == '1':
        ans.append(i)
    else:
        if len(ans) == 0:
            continue
        else:
            del ans[-1]
print((''.join(ans)))


x=input()
z=''

for i in x:
  if i == '0':
    z= z+i
  elif i == '1':
    z= z+i
  elif i == 'B':
    z= z[:-1]

print(z)  

buf=''
for c in input():
  if c=='B': buf=buf[:-1]
  else: buf += c
print(buf)

buf = ''
str = input()
for i in range(len(str)):
    if str[i] == 'B':
        if len(buf) != 0:
            buf = buf[0:len(buf)-1]
        else:
            continue
    else:
        buf += str[i]

print(buf)

s = input()
x = []
for i in range(len(s)):
    if s[i] == "0":
        x.append("0")
    elif s[i] == "1":
        x.append("1")
    elif s[i] == "B" and len(x) > 0 :
        x.pop(-1)
print("".join(x))

s = input()
a = ""
for i in s:
    if i == "0":
        a+="0"
    elif i == "1":
        a+="1"
    else:
        if a!="":
            a=a[:-1]
        
print(a)

s = input()
ans = []
for i in range(len(s)):
    if s[i] == 'B':
        if ans:
            ans.pop()
    else:
        ans.append(s[i])
print((''.join(ans)))



s = input()

ans = ""
for c in s:
    if c == '0':
        ans += c
    elif c == '1':
        ans += c
    else: # c == 'B'
        if ans != "":
            ans = ans[:-1]

print(ans)

s=input()
output=''
for i in s:
    if i!='B':
        output+=i
    elif i=='B':
        output=output[:-1]
print(output)


a = list(input())
ans = []
for i in range(len(a)):
    if a[i] == '0':
        ans.append('0')
    elif a[i] == '1':
        ans.append('1')
    elif a[i] == 'B':
        if ans == []:
            continue
        else:
            ans.pop(-1)
print(''.join(ans))

S = input()

F = []
for ch in S:
  if ch == "B": 
    if len(F) > 0:
      F.pop()
  else:
    F.append(ch)
    
print("".join(F))

s = list(input())
w_len = len(s)
word = []
for x in range(w_len):
  if s[x] == 'B':
    if word != []:
      word.pop(-1)
  else:
    word.append(s[x])
result = ''
for y in word:
  result = result+y
print(result)

s = input()
a = ""
for i in range(len(s)):
  if s[i] == "B":
    a = a[:-1]
  else:
    a += s[i]
print(a)

a = list(input())

b = []

for i in range(int(len(a))):
	t = a[int(i)]
	if t == "0":
		b.append("0")
	elif t == "1":
		b.append("1")
	else :
		if len(b) > 0:
			del b[-1]
print("".join(b))

import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    S = input()
    ans = ""
    for i in S:
        if i != "" and i == "B":
            ans = ans[:-1]
        if i != "B":
            ans = ans + i
    print(ans)
   

def __starting_point():
    main()
__starting_point()

s = str(input())
a = []
 
for i in range(len(s)):
    if s[i] == '0':
        a.append('0')
    elif s[i] == '1':
        a.append('1')
    else:
        if len(a) != 0:
            a.pop()
 
print(''.join(a))

s = list(input())
li = []
for i in s:
    if i == '0':
        li.append('0')
    elif i == '1':
        li.append('1')
    elif i == 'B':
        if li == []:
            pass
        else:
            li.pop(-1)
print(''.join(li))

binaryKeyboard=list(input())
ans=[]
for i in binaryKeyboard:
  if i=="0" or i=="1":
    ans.append(i)
  else:
    if len(ans)==0:
      continue
    else:
      del ans[-1]
print(''.join(ans))

S=list(input())

ans=[]

for s in S:
  if s == "B":
    if len(ans)>0:
      del ans[-1]
  else:
    ans.append(s)
    
print("".join(ans))

s = str(input())
a = []

for i in range(len(s)):
    if s[i] == '0':
        a.append('0')
    elif s[i] == '1':
        a.append('1')
    else:
        if len(a) != 0:
            a.pop()

print(''.join(a))

n=[]
for i in input():
  if i=='B':
    if n: n.pop()
  else:
    n.append(i)
print(*n,sep='')

S = input()
ans = ""
for s in S:
    if s == "B":
        if ans:
            ans = ans[:-1]
    else:
        ans += s
print(ans)


s=list(input())
ans=list()
for i in s:
    if i=="0":
        ans.append(0)
    elif i=="1":
        ans.append(1)
    else:
        try:
            ans.pop(-1)
        except:
            pass
for i in ans:
    print(i,end="")
print()

s=input()
a=''

for i in s:
  if i=='B':
    a=a[:-1]
    
  else:
    a+=i
print(a)


def handle_string(string):
    new_string = ''
    for i in range(len(string)):
        if string[i]=='B':
            if len(new_string)!=0:
                new_string = new_string[0:len(new_string)-1]
            else:
                continue
        else:
            new_string = new_string+string[i]
    return new_string
input_string = input()
print(handle_string(input_string))

n = input()
a = ""
for i in n:
  if i =="0":
    a+=i
  elif i =="1":
    a+=i
  elif i =="B":
    a = a[:-1]
print(a)

s = list(input())
x = len(s)
a = []

for i in range(x):
  if s[i] == '0':
    a.append('0')
  elif s[i] == '1':
    a.append('1')
  elif s[i] == 'B':
    if a == []:
      continue
    else:
      a.pop(-1)
b = ''.join(a)
print(b)

s=input()
data=[]
for i in range(len(s)):
  if s[i]=='0':
    data.append('0')
  elif s[i]=='1':
    data.append('1')
  else:
    if len(data)==0:
      continue
    else:
      data.pop()
print(*data,sep='')

n = ""
command = input()
for i in command:
  if i == "B":
    n=n[:-1]
  else:
    n+=i
print(n)

#!/usr/bin/env python3

S = input()
ret = ''
for i in range(len(S)):
    if S[i] == '0': ret += '0'
    elif S[i] == '1': ret += '1'
    else: ret = ret[:-1]

print(ret)


s=input()
ans=''
for c in s:
  if c=='0':
    ans+='0'
  elif c=='1':
    ans+='1'
  else:
    ans=ans[:len(ans)-1]
print(ans)

s = str(input())
ans = ""
for i in range(len(s)):
  if(s[i]!="B"):
    ans += s[i]
  else:
    if(ans != ""):
      ans = ans[:-1]
print(ans)



#!/usr/bin/env python3
s = input()
len_s = len(s)

text = ''
for i in range(len_s):
    if s[i] == '0':
        text += '0'
    elif s[i] == '1':
        text += '1'
    else:
        if text == '':
            pass
        else:
            text = text[:-1]
print(text)


key = list(input())
ans = []

for i in key:
    if i == '0' or i == '1':
        ans.append(i)
    elif len(ans) == 0:
        continue
    else:
        del ans[-1]

print(''.join(ans))

s=input()
ans=''
for i in s:
  if i!='B':
    ans+=i
  else:
    ans=ans[:-1]
print(ans)

s = input()
ans = ''
for i in range(len(s)):
    if s[i] == '0':
        ans += '0'
        
    elif s[i] == '1':
        ans += '1'
        
    else:
        if ans != '':
            ans = ans[:-1]
            
print(ans)

from collections import deque


def main():
    ss = list(input())
    ans = deque([])
    for s in ss:
        if s == '0':
            ans.append(s)
        elif s == '1':
            ans.append(s)
        else:
            if len(ans) == 0:
                pass
            else:
                ans.pop()
    print(*list(ans), sep='')


def __starting_point():
    main()

__starting_point()

s = input()

out =''
for x in s:
    if x != 'B':
        out += x
    else:
        if out == '':
            continue
        else:
            out = out[:-1]
print(out)

from sys import stdin
input = stdin.readline

S = input().strip()
P = ''
for s in S:
    if s == 'B':
        if P != '':
            P = P[:-1]
    else:
        P = P + s
print(P)

first_str =input()

input_list = list(first_str)

total_list = list()

for i in input_list:
    if i == "0":
        total_list.append("0")
        
    elif i == "1":
        total_list.append("1")
    
    else:
        if not total_list:
            pass
        else:
            total_list.pop(-1)
    
total = "".join([str(_) for _ in total_list])
print(total)

# -*- coding: utf-8 -*-

S = list(input())
ans = []

for i in range(len(S)):
    if S[i] == 'B':
        if len(ans) == 0:
            continue
        else:
            ans.pop()
    else:
        ans.append(S[i])

for i in range(len(ans)):
    print(ans[i] , end = "")

print()



import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    s = ins()
    x = []
    for c in s:
        if c in "01":
            x.append(c)
        elif x:
            x.pop()
    return "".join(x)


print(solve())


S = str(input())

stack = []

for s in S:
    if s == '0' or s == '1':
        stack.append(s)
    elif s == 'B':
        if not stack:
            continue
        else:
            stack.pop()

for s in stack:print(s,end='')

s = input()
ans = ''

for char in s:
    if char == '0':
        ans += '0'
    if char == '1':
        ans += '1'
    if char == 'B':
        ans = ans[:-1]
print(ans)

S = input()

ans = ''
for s in S:
    if s == '0':
        ans+='0'
    elif s == '1':
        ans += '1'
    else:
        if len(ans)>0:
            ans = ans[:-1]
print(ans)


s = input()
ans = ''
for c in s:
    if c == '0':
        ans += '0'
    elif c == '1':
        ans += '1'
    else:
        ans = ans[:len(ans) - 1]
print(ans)

s = list(input())
ans = []
for i in range(len(s)) :
    if s[i] == "0" :
        ans.append("0")
    elif s[i] == "1" :
        ans.append("1")
    elif s[i] == "B" and len(ans) > 0 :
        del ans[-1]
print(("".join(ans)))


#!/usr/bin/env python3
import sys


def solve(s: str):
    a = []
    for c in s:
        if c == "B":
            if a:
                a.pop()
        else:
            a.append(c)
    return "".join(a)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    print((solve(s)))

def test():
    import doctest
    doctest.testmod()

def __starting_point():
    #test()
    main()

__starting_point()

s = [ss for ss in str(input())]
ans = []
for i in s:
    if i == "0" or i == "1":
        ans.append(i)
    elif len(ans) > 0:
        ans.pop(-1)
print("".join(ans))

def main():
    s = str(input())

    ans = []
    for val in s :
        if val == "B" and ans == [] :
            pass
        elif val == "B" and ans != [] :
            ans.pop(-1)
        else :
            ans.append(val)

    ans_str = ""
    for val in ans :
        ans_str = ans_str + val

    print(ans_str)



def __starting_point():
    main()

__starting_point()

s = input()
l = []
for i in range(len(s)):
    if s[i] == '0':
        l.append('0')
    elif s[i] == '1':
        l.append('1')
    else:
        if l == []:
            continue
        else:
            del l[-1]
print((''.join(l)))


s = input()
ans = []

for i in s:
    if i=='B':
        if ans != []:
            ans.pop(-1)
    else:
        ans.append(i)
print(''.join(ans))

n = input()
str = ''
for i in n:
  if i == '0' or i == '1':
    str = str + i
  if i == 'B':
    str = str[:-1]
    
print(str)

s = input()
ans = []
for i in s:
  if i == "0":
    ans.append(0)
  elif i == "1":
    ans.append(1)
  else:
    if len(ans) != 0:
      ans.pop(-1)
print(*ans,sep="")

s = input()

ans=""

for i in range(len(s)):
    if s[i]=="B":
        ans = ans[:-1]
    else:
        ans+=s[i]
print(ans)

from collections import deque
d = deque()
for c in input():
  if c != 'B': d.append(c) 
  elif len(d) != 0: d.pop()
print(*d, sep='')

s = input()
ans = ''
for i in range(len(s)):
	if s[i] == '0':
		ans += '0'    
	elif s[i] == '1':
		ans += '1'    
	else:
		if ans != '':
			ans = ans[:-1]    
print(ans)

# cook your dish here
s = str(input())
a = ""
for i in s:
  if i!='B':
    a = a + i
  else:
    if len(a)!=0:
      a = a[0:len(a)-1]
print(a)

s = input()
a = []
for c in s:
    if c in ['0', '1']:
        a.append(c)
    else:
        if len(a) != 0:
            a.pop()
print(''.join(a))

s = input()
numB = 0
r = ""
for i in range(len(s))[::-1]:
  if s[i] == "B":
    numB = numB+1
    continue
  if numB > 0 and (s[i]=="0" or s[i]=="1"):
    numB = numB-1
    continue
  r = r + s[i]

print((''.join(list(reversed(r)))))



s = input()

stack = []

for c in s:
    if c == "B":
        if len(stack) == 0:
            continue
        else:
            stack.pop(-1)
    else:
        stack.extend(c)
for c in stack:
    print(c, end="")


#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-10-03 20:05:16 +0900
# LastModified: 2020-10-03 20:28:14 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    S = input()
    stack = []
    for s in S:
        if s == '0' or s == '1':
            stack.append(s)
        elif s == 'B' and stack:
            stack.pop()
    for sta in stack:
        print(sta, end="")
    print()





def __starting_point():
    main()

__starting_point()

s=input()
res=""
for i in s:
    if i!="B":
        res+=i
    else:
        res=res[:len(res)-1]
print(res)

s = input()
lis = []
for c in s:
    if c == 'B':
        if len(lis):
            lis = lis[:-1]
        else:
            continue
    else:
        lis.append(int(c))

for i in lis:
    print(i, end="")
print()

i = input()
ans = ""
for s in i:
  if s != "B":
    ans += s
  else:
    ans = ans[:-1]
  
print(ans)

import math
from datetime import date

def main():
		
	s = input()
	ans = []

	for c in s:
		if c != 'B':
			ans.append(c)
		else:
			if len(ans) != 0:
				ans.pop();

	line = ""
	for c in ans:
		line += c

	print(line)
	
main()


#!/usr/bin/env python3
s=input()
ans=[]
for i in s:
    if i=='0' or i=='1':
        ans.append(i)
    else:
        if len(ans):
            ans.pop()
print(''.join(ans))

s=input()
fin=""
for c in s:
    if c=='1':
        fin+="1"
    elif c=='0':
        fin+="0"
    else:
        if len(fin)>0:
            fin=fin[:-1]
print(fin)


a = input()
test = ''
for i in range(len(a)):
  if a[i] == '0':
    test += '0'
  elif a[i] == '1':
    test += '1'
  else:
    if len(a) == 0:
      pass
    else:
      test = test[:-1]
    
print(test)

S = str(input())

ans = []
for i in range(len(S)):
  if S[i] == "B":
    if ans == []:
      continue
    else:
      ans = ans[:-1]
  else:
    ans.append(S[i])
  #print(ans)
#print(ans)  

for i in range(len(ans)):
  print(ans[i], end = "")

s = str(input())
ans = []
for i in range(len(s)):
    if s[i] == "B":
        if len(ans) != 0: ans.pop()
    else : ans.append(s[i])
print(''.join(ans))

s = input()
S = ""
for i in s:
  if i == "B":
    S = S[:-1]
  else:
    S += i
print(S)

s = input()
ans = ""
for i in s:
    if i == 'B':
        if ans != "":
            ans = ans[:-1]
    else:
        ans += i
print(ans)

s=input()
ans=""
for c in s:
  if c=='B':
    if ans:
      ans=ans[0:-1]
  else:
    ans+=c
print(ans)

s = input()
ans = ""
for char in s:
    if char == 'B':
        if ans == "":
            pass
        else:
            l = len(ans)
            ans = ans[0:l-1]
    else:
        ans += char
print(ans)


import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: list(map(int, sys.stdin.readline().split()))
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
ans = ''
for i in s:
    if i == '0':
        ans += '0'
    elif i == '1':
        ans += '1'
    elif ans:
        ans = ans[:-1]
print(ans)














# https://atcoder.jp/contests/abc043/tasks/abc043_b

"""
双方向キューをつかって実装する

このどれかの操作ができる
* 0 をキューに入れる
* 1 をキューに入れる
* キューの最後のものを出す

注意: キューが空の場合にバックスペースをしても何も起きないようにする
"""

from collections import deque

q = deque()

s = input()
for operation in s:
    if operation == "0":
        # 右端に0を追加
        q.append("0")

    elif operation == "1":
        # 右端に1を追加
        q.append("1")

    elif operation == "B":
        # バックスペース
        # 右端を一つ削除
        # q の中身が空でもエラーにならないように例外処理
        try:
            q.pop()
        except IndexError:
            pass # 何もしない

# キューの中身を順番に取り出して文字列に変換
answer = ""
for i in q:
    answer = answer + i

print(answer)


s=str(input())

l=[]
for i in s:
  if i=="0" or i=="1":
    l.append(i)
  elif i=="B" and len(l)!=0:
    l.pop(len(l)-1)
    
print(*l,sep='')
      

import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()

ans = ''
for i in range(len(s)):
    if s[i] == 'B':
        if len(ans) == 0: continue
        ans = ans[0:-1]
    else:
        ans += s[i]
print(ans)

s = input()
ans = []
for i in range(len(s)):
  if s[i] == "B":
    if len(ans) != 0:
      ans.pop()
  else:
    ans.append(s[i])
print("".join(ans))

s = input()
ans = ''

for i in range(len(s)):
    if s[i] != 'B':
        ans += s[i]
    else:
        ans = ans[:-1]

print(ans)

s = input()
L = []
for x in s:
    if x == "0":
        L.append("0")
    elif x == "1":
        L.append("1")
    else:
        if len(L) >= 1:
            del L[-1]
print("".join(L))

def answer(s: str) -> str:
    result = ''
    for c in s:
        if c == 'B':
            result = result[:-1]
        else:
            result += c

    return result

def main():
    s = input()
    print((answer(s)))

def __starting_point():
    main()

__starting_point()

s = input()
ans = ""
for char in s:
    if char != 'B':
        ans += char
    else:
        if ans == "":
            pass
        else:
            le = len(ans)
            ans = ans[0:le - 1]
print(ans)


s = input()
ans = ""
for i in s:
  if i == "B":
    ans = ans[:-1]
  else:
    ans += i
print(ans)

s = input()
st = []
for e in s:
  if e == 'B':
    if len(st) != 0:
      st.pop()
  else:
    st.append(int(e))
print((''.join(map(str,st))))


s = list(input())
res = []
for i in range(len(s)):
  if s[i] == "1":
    res.append("1")
  elif s[i] == "0":
    res.append("0")
  else:
    if res == []:
      continue
    else:
      del res[-1]

print("".join(res))

a = input()
b = ''
for elem in a:
  if elem == '1':
    b +='1'
  elif elem == '0':
    b += '0'
  else:
    b = b[:-1]
print(b)

s = input()
ans = ''
for c in s:
    if c == '0':
        ans += '0'
    elif c == '1':
        ans += '1'
    elif c == 'B' and ans:
        ans = ans[:-1]
print(ans)

s = input()
ans = ''

for c in s:
    if c != 'B':
        ans += c
    else:
        ans = ans[:-1]

print(ans)

s=input()
a=""
for i in range(len(s)):
    if s[i]=="0":
        a+="0"
    elif s[i]=="1":
        a+="1"
    else:
        if a!="":
            a=a[:-1]
print(a)

s = input()
ans = ""
for _ in range(len(s)):
    if s[0] == "0":
        ans += "0"
        s = s[1:]
    elif s[0] == "1":
        ans += "1"
        s = s[1:]
    else:
        s = s[1:]
        ans = ans[:-1]
print(ans)


opperations = list(input())
display_stack = []
for opperation in opperations:
    if opperation == "B":
        if display_stack:
            display_stack.pop()
    else:
        display_stack.append(opperation)
print(''.join(display_stack))

s = input()
res = ""
for i in range(len(s)):
    if s[i] == "1" or s[i] == "0":
        res += s[i]
    elif s[i] == "B" and len(res) != 0:
        res = res[:-1]

print(res)