Problem:
 Score : 200 points    Problem Statement 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 1 01B0      Sample Output 1 00  Each time the key is pressed, the string in the editor will change as follows: 0 , 01 , 0 , 00 .       Sample Input 2 0BB1      Sample Output 2 1  Each time the key is pressed, the string in the editor will change as follows: 0 , (empty) , (empty) , 1 .

Solution (Python):
ss = list(input())

screen = []
for s in ss:
    if s == 'B':
        if len(screen) == 0:
            pass
        else:
            screen.pop()
    else:
        screen.append(s)

print(''.join(screen))

Solution (Python):
S=input()
ans=[]
for i in range(len(S)):
  if S[i] in ["0","1"]:
    ans.append(S[i])
  elif len(ans) > 0:
    ans.pop(-1)
print("".join(ans))

Solution (Python):

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

Solution (Python):
s = input()
display = []
for key in s:
  if key == "B":
    if display != []:
      del display[-1]
  else:
    display.append(key)
print("".join(display))

Solution (Python):
s=input()

k=""

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

Solution (Python):
s = input()
s_out = ""
s = s[1:] if s[0] == "B" else s
for c in s:
  if c == "B":
    s_out = s_out[:-1]
  elif c == "0":
    s_out += "0"
  elif c == "1":
    s_out += "1"
print(s_out)

Solution (Python):
temp = ""

in_keys = input().rstrip()

while(True):

    index = in_keys.find("B")
    if index == -1:
        break
    elif index == 0:
        temp = in_keys[1:]
    else:
        temp = in_keys[:index-1] + in_keys[index+1:]
        

    in_keys = temp

print(in_keys)

Solution (Python):
s = input()
ans = ''

for i in s:
    if i != 'B':
        ans += i
    elif i == 'B':
        ans = ans[:-1]

print(ans)

Solution (Python):
S = input()

result = ""
for c in S:
    if c == "0" or c == "1":
        result += c
    elif c == "B" and result != "":
        result = result[:-1]

print(result)

Solution (Python):
S = list(input())
l = 0
o = ['']*10
for s in S:
    if s == 'B':
        l = max(0,l-1)
    else:
        o[l] = s
        l += 1

print(''.join(o[0:l]))

Solution (Python):
s = input()

editer = ''
for character in s:
    if character != 'B':
        editer += character
    elif character == 'B' and editer:
        editer = editer[:-1]

print(editer)

Solution (Python):
s = input()
r = ""
for t in s:
    if t == "B":
        if len(r) != 0:
            r = r[:-1]
    else:
        r += t
print(r)

Solution (Python):
s=input()
x=[]
for a in s:
    if a=='B':
        if len(x)>0:
            x = x[:-1]
    else:
        x.append(a)
print(''.join(x))

Solution (Python):
s=input()
t=""
for c in s:
    if c == "0":
        t += "0"
    elif c == "1":
        t += "1"
    elif t != "":
        t = t[:-1]
print(t)

Solution (Python):

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

print(ans)

Solution (Python):
s=input()
for i in s:
    if i == 'B'and s.index(i) == 0:
        s=s[1:]
    elif   i == 'B'and s.index(i) !=0 :
        s=s[:s.index(i)-1]+s[s.index(i)+1:]
    
print(s)

Solution (Python):
s = list(input())
ans = ''
for i in s:
	if i == 'B' and len(ans) > 0:
		ans = ans[:-1]
	elif i == '0' or i == '1':
		ans = ans + i
print(ans)

Solution (Python):
s = input()
ans = []
for c in s:
    if c != 'B':
        ans.append(c)
    else:
        if len(ans) > 0:
            ans.pop()
print(''.join(ans))

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

Solution (Python):

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

Solution (Python):
s=list(input())
out=[]
for i in range(len(s)):
  if s[i]=="1":
    out.append(s[i])
  if s[i]=="0":
    out.append(s[i])
  if len(out)!=0 and s[i]=="B":
    del(out[-1])
print("".join(out))

Solution (Python):
s = input()
w = ""
for i in s:
    if i == "0":
        w += "0"
    elif i == "1":
        w += "1"
    else:
        w = w[:-1]

print(w)

Solution (Python):
s=input()
W=''
for i in s:
    if i=='0':
        W += '0'
    elif i=='1':
        W+='1'
    else:
        W=W[:-1]

print(W)

Solution (Python):
s=input()
n=len(s)
d=[]
for i in range(n):
  if'B'==s[i]:
    d.append(d[-1][:-1]if i>0else '')
  else:
    d.append(d[-1]+s[i]if i>0else s[i])
print(d[-1])

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

Solution (Python):


s = list(input())

strng = ''
for i in s:
    if i == '0':
        strng += '0'
    elif i == '1':
        strng += '1'
    else:
        if strng:
            strng = strng[:-1]

print(strng)

Solution (Python):
def main():
	s = input()
	ans = ""
	for c in s:
		if c == "B" and ans:
			ans = ans[:-1]
		elif c != "B":
			ans += c
	print(ans)

if __name__ == '__main__':
	main()

Solution (Python):
x = input()

for i in range(11):
  x=x.replace('1B', '')
  x=x.replace('0B', '')

x=x.replace('B', '')

print(x)

Solution (Python):
s = list(input())

ans = ""
for x in s:
    if x == 'B':
        if len(ans) != 0:
            ans = ans[:-1]
    else:
        ans += x

print(ans)

Solution (Python):

s = str(input())
ret = ''
for c in s:
  if c=='B':
    if ret!='':
      ret = ret[:-1]
  else:
    ret += c
print(ret)

Solution (Python):
import sys
from collections import Counter

s = input()
ans = ''

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

print(ans)

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

Solution (Python):
s = str(input())
n = len(s)

editer = []
for i in range(n):
    if s[i] != "B":
        editer.append(s[i])
    else:
        if len(editer) != 0:
            editer.pop(-1)
print("".join(editer))

Solution (Python):
s = list(input())
a = []
for i in s:
    if i!="B":
        a.append(i)
    if i=="B" and len(a)>0:
        a.pop(-1)
print(*a,sep="")

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

Solution (Python):
S = input()

disp = []
for s in S:
    if s == "B":
        if len(disp) > 0:
            disp.pop()
        continue
    disp.append(s)
print("".join(disp))

Solution (Python):
S = input()

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

print(''.join(res))

Solution (Python):
s = input()
ans = ""
for i in range(len(s)):
    if s[i] == "0":
        ans = ans + "0"
    elif s[i] == "1":
        ans = ans + "1"
    elif s[i] == "B":
        ans = ans[:len(ans)-1]
print(ans)

Solution (Python):
s = input()
pre = []
for i in s:
    if i == '0' or i == '1':
        pre.append(i)
    else:
        if pre != []:
            del pre[-1]

ans = ''
for i in pre:
    ans += i
print(ans)

Solution (Python):
s = input()
stack =[]

for i in s:
    if i == "B":
        if stack!=[]:stack.pop()
    else:
        stack.append(i)
result="".join(stack)
print(result)

Solution (Python):
s=input()
from collections import deque
stack=deque([])
for c in s:
    if c == 'B':
        if stack:
            stack.pop()
    else:
        stack.append(c)
print(''.join(stack))

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

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

Solution (Python):
s = []
for i in input():
    if i == 'B':
        if len(s):
            s.pop(-1)
    else:
        s += i
print(''.join(s))

Solution (Python):
n=''
for c in input():
    if c == '0':
        n += '0'
    if c == '1':
        n += '1'
    if c == 'B':
        if len(n)>0:
            n=n[:-1]
print(n)

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

Solution (Python):
s = input()
ans = []
for i in s:
    if i != 'B':
        ans.append(i)
    else:
        if ans:
            del ans[-1]

print(''.join(ans))

Solution (Python):

def read_input():
    s = input().strip()
    return s


def submit():
    s = read_input()

    result = []
    for c in s:
        if c == 'B':
            result = result[:-1]
        else:
            result.append(c)

    t = ''.join(result)
    print(t)


if __name__ == '__main__':
    submit()

Solution (Python):
s = input()
ans = s
while 'B' in ans:
    ans = ans.lstrip('B').replace('0B', '').replace('1B', '')
print(ans)

Solution (Python):
s = input()
ans =[]
for i in range(len(s)):
    if s[i] == '0':
        ans.append('0')
    elif s[i] == '1':
        ans.append('1')
    elif len(ans) != 0:
        ans.pop(-1)
print(''.join(ans))

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

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

Solution (Python):


def solve(S):
    A = []
    for i in range(len(S)):
        if(S[i]=="0" or S[i]=="1"):
            A.append(S[i])
        elif(len(A)>0 and S[i]=="B"):
            A.pop()
    print("".join(A))
    
if __name__ == '__main__':
    S = input()
    
    solve(S)

Solution (Python):
s=input()

output=[]

for i in range(len(s)):
    if s[i]=='0':
        output.append('0')
    elif s[i]=='1':
        output.append('1')
    elif s[i]=='B':
        if len(output)!=0:
            del output[len(output)-1]

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

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())
    ans = []
    for s in S:
        if s == '0':
            ans.append('0')
        elif s == '1':
            ans.append('1')
        else:
            if len(ans) > 0:
                ans.pop()

    print(*ans, sep='')


if __name__ == '__main__':
    main()

Solution (Python):
n = input()

s = ''
for each in n:
    if each == '0' or each == '1':
        s += each
    else:
        s = s[:-1]
print(s)

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

Solution (Python):
from sys import stdin
input=stdin.readline().rstrip()
output_list=[]
for i in range(len(input)):
  if input[i]!="B":
    output_list.append(input[i])
  else:
    if len(output_list)!=0:
      output_list.pop(-1)
      

output="".join(output_list)
print(output)

Solution (Python):

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


print(ans)

Solution (Python):
s = input()
o = []
for i in s:
  if i == 'B':
    if len(o) > 0:
      o.pop()
  else:
    o.append(i)
print(''.join(o))

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

Solution (Python):

s = input()
while "0B" in s or "1B" in s:
    s = s.replace("0B","").replace("1B","")
s = s.replace("B","")
print(s)

Solution (Python):
s = input()
s = list(s)
res = []
for i in s:
    if i=="B":
        if res != []:
            res.pop(len(res)-1)
    elif i=="1":
        res += "1"
    else:
        res += "0"
print("".join(res))

Solution (Python):
s=input()
ans=[]
for i in range(len(s)):
  if s[i]=="B" and len(ans)!=0:
    ans.pop()
  elif s[i]!="B":
    ans.append(s[i])
print(*ans,sep="")

Solution (Python):

s=input()

a=''
for x in s:
  if x=='0':
    a+='0'
  elif x=='1':
    a+='1'
  else:
    
    if a!='':
      a=a[:-1]


print(a)

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

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

Solution (Python):

s = input()

x = ""
for i in s:
    if i != "B":
        x = x + i
    else:
        x = x[:-1]

print(x)

Solution (Python):
c = list(input())
ans = []
for i in range(len(c)):
    if c[i] == '0':
        ans.append('0')
    elif c[i] == '1':
        ans.append('1')
    elif len(ans) != 0:
        del ans[-1]
    else:
        continue

print (''.join(ans))

Solution (Python):
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 len(ans)!=0:
        del ans[-1]
    else:
        continue
print(''.join(ans))

Solution (Python):
s = input()
n= len(s)
a=[]

for i in range(n):
    if s[i]!='B':
        a.append(s[i])
    else:
        if a!=[]:
            del a[-1]
print(''.join(a))

Solution (Python):
S=input()
new_S=str()
for ii in list(S):
    if ii=='B':
        new_S=new_S[:-1]
    else:
        new_S+=ii
        
print(new_S)

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

Solution (Python):
x = input()
s = []
for i in x:
  if i == 'B':
    if len(s) == 0:
      continue
    del s[-1]
  else:
    s.append(i)
print(''.join(s))

Solution (Python):
s=input()
s=list(s)
l=[]
ls=len(s)
for i in range (ls):
    if s[i]=='1':
        l.append(1)
    elif s[i]=='0':
        l.append(0)
    else:
        if len(l)==0:
            l=l
        else:
            l.pop()
ans=""
for i in range(len(l)):
    ans=ans+str(l[i])
print(ans)

Solution (Python):


s = list(input())
str = ""

for x in s:
    if x != "B":
        str += x
    else:
        str = str[:-1]

print(str)

Solution (Python):


s=list(input())
ans=""

for i in range(0,len(s),1):
    if s[i]=="1" or s[i]=="0":
        ans=ans+s[i]
    else:
        ans=ans[:-1]

print(ans)

Solution (Python):
S = list(input())
ans = []
for i in S:
    if (i == "0"):
        ans.append("0")
    elif (i == "1"):
        ans.append("1")
    else:
        if (len(ans) != 0):
            del ans[-1]
print("".join(ans))

Solution (Python):

s=str(input())

ans=""

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

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

Solution (Python):
answer =[]

for letter in input():
  if letter=="1":
    answer.append("1")    
  elif letter=="0":
    answer.append("0")    
  elif letter=="B" and len(answer)>0:
    answer.pop()
    
print("".join(answer))

Solution (Python):
s = list(input())
t = ""
for s_ in s:

    if s_ != "B":
        t += s_
    else:
        t = t[:-1]
print(t)

Solution (Python):


s = str(input())
ans = ""

for i in range(0,len(s),1):
    if s[i] =="1" or s[i] == "0":
        ans += s[i]
    else:
        ans=ans[:-1]

print(ans)

Solution (Python):
S = input()
ans = ''
for i in range(len(S)):
    if S[i] == 'B':
        if ans != '':
            ans = ans[:len(ans)-1]
    else:
        ans += S[i]
print(ans)

Solution (Python):
def unhappy_hacking(s: str) -> str:
    display = ''

    for key in s:
        if key == '0':
            display += '0'
        elif key == '1':
            display += '1'
        else:  
            display = display[:-1]

    return display


if __name__ == "__main__":
    s = input()
    ans = unhappy_hacking(s)
    print(ans)

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

Solution (Python):
s = input()



ans = []
for key in range(len(s)):

    if s[key] == "0" or s[key] == "1":
        ans.append(s[key])
    if s[key] == "B" and len(ans) > 0:
        ans.pop(-1)
print("".join(ans))

Solution (Python):
s = input()

ans = ''
for x in s:
    if x in ['0', '1']:
        ans += x
    else:
        ans = ans[:-1]

print(ans)

Solution (Python):
hoge=input()
ans=[]

while len(hoge):
  if(hoge[0]=="0"):
    ans.append(0)
    hoge=hoge[1:]
  elif(hoge[0]=="1"):
    ans.append(1)
    hoge=hoge[1:]
  else:
    if(len(ans)>0):
      ans=ans[:-1]
    hoge=hoge[1:]

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

Solution (Python):
s = list(input())
ans = []
for n in s:
  if n == "0":
    ans.append("0")
  elif n == "1":
    ans.append("1")
  elif n == "B":
    if len(ans) != 0:
      ans.pop(-1)
  
print("".join(ans))

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

Solution (Python):
n =input()
m = ''
for i in range(len(n)):
        if n[i] == 'B':
                if not m:
                        print('')
                else:
                        m= m[:-1]
        else:
         m += n[i]
print(m)

Solution (Python):
from sys import stdin
input = stdin.readline
s = input().rstrip()
ans = []
for i in s:
	
	if i == "0":
			ans.append("0")
	elif i == "1":
			ans.append("1")
	else:
		if not ans == []:
			ans.pop(-1)
print("".join(ans))

Solution (Python):
a = [str(x) for x in input()]

N = len(a)
b = []

for i in range(N):
    if a[i] == "0":
        b.extend("0")
        
    elif a[i] == "1":
        b.extend("1")
        
    else:
        if len(b) == 0:
            pass
        else:
            b.pop(-1)
            

print("".join(b))

Solution (Python):
input_line = input()
str = ""

for i in range(0,len(input_line)):
  if input_line[i] == '0':
    str += "0"
  elif input_line[i] == '1':
    str += "1"
  elif input_line[i] == 'B':
    str = str[:-1]
else:
  print(str)

Solution (Python):
input_line = input()
str = ""

for i in range(0,len(input_line)):
  if input_line[i] == '0':
    str += "0"
  elif input_line[i] == '1':
    str += "1"
  elif input_line[i] == 'B':
    str = str[:-1]
else:
  print(str)

Solution (Python):
s = input()

res = ""
for x in s:
    if x =="B":
        res = res[:-1]
    else:
        res += x

print(res)

Solution (Python):
s = input()

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

print(ans)

Solution (Python):
s = input()
ans = []
for i in s:
    if i == '0' or i == '1':
        ans.append(i)
    elif i == 'B':
        if len(ans) == 0:
            pass
        else:
            ans.pop()
print(''.join(ans))

Solution (Python):
s = input()
ans = ''
for i in s:
    if i == '0' or i == '1':
        ans += i
    else:
        ans = ans[:-1]

print(ans)

Solution (Python):

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


"""
n = I()
print((n*(n+1))//2)
"""

s = S()
ans = []
for i in s:
    if i == "0":
        ans.append(0)
    if i == "1":
        ans.append(1)
    if i == "B" and ans:
        ans.pop(-1)
for i in ans:
    print(i,end = "")
print()



"""
s = S()
l = len(s)
for i in range(l-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        quit()
for i in range(l-2):
    if s[i] == s[i+2]:
        print(i+1,i+3)
        quit()
print(-1,-1)
"""

Solution (Python):
s = input()
ans = []
for i in range(len(s)):
    if s[i] == '0':
        ans.append('0')
    if s[i] == '1':
        ans.append('1')
    if s[i] == 'B':
        if len(ans) != 0:
            ans.pop(-1)
print(''.join(ans))

Solution (Python):
from functools import reduce

def main():
    
    
    
    
    

    
    
    s = list(input().rstrip())
    ans = []
    i = 0
    for char in s:
        if char=='0' or char=='1':
            ans.append(char)
        elif char=='B' and len(ans) > 0:
            ans.pop()
    
    print(''.join(ans))    
   
if __name__ == '__main__':
    main()

Solution (Python):

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

Solution (Python):
S = list(input())
ans = []

for i in range(len(S)):
    if S[i] == 'B':
        if len(ans) == 0:
            pass
        else:
            del ans[-1]
        
    else:
        ans.append(S[i])

for x in ans:
    print(x,end='')
print()

Solution (Python):
S = list(input())
ans = []

for i in range(len(S)):
    if S[i] == 'B':
        try:
            del ans[-1]
        except IndexError:
            pass
    else:
        ans.append(S[i])

for x in ans:
    print(x,end='')
print()

Solution (Python):
S = list(input())
i = 0
while 'B' in S:
    if S[i] == 'B':
        if i == 0:
            del S[0]
            i = 0
            continue
        else:
            del S[i-1]
            del S[i-1]
            i = 0
            continue
    i += 1
for x in S:
    print(x, end='')
print()

Solution (Python):
s = input()

res = ""
for x in s:
    if x =="B":
        res = res[:-1]
    else:
        res += x

print(res)

Solution (Python):
w = input()
res = []
for i in w:
    if i =='1':
        res.append(i)
    elif i == '0':
        res.append(i)
    elif len(res) > 0:
        res.pop()
    else:
        pass
print(''.join(res))

Solution (Python):
def main():
    s = input()
    ans = ""
    for c in s:
        if c == "B":
            ans = ans[:-1]
        else:
            ans += c
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
Ss = [i for i in input()]
ans = []
for s in Ss:
    if s == "0":
        ans.append("0")
    elif s == "1":
        ans.append("1")
    else:
        if len(ans)==0:
            continue
        else:
            del ans[-1]
print("".join(ans))

Solution (Python):
s = input()
s_list = list(s)
count = s.count('B')
for _ in range(count):
  ind = s_list.index('B')
  if ind > 0:
    s_list[ind-1] = ''
  s_list[ind] = ''
  s = ''.join(s_list)
  s_list = list(s)
s = ''.join(s_list)
print(s)

Solution (Python):
s = input()

answer = ''
for i in s:
    if i == '1' or i == '0':
        answer += i
    elif len(answer) > 0:
        answer = answer[:-1]

print(answer)

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

print(res)

Solution (Python):
r = []
for c in input():
	if c == "B":
		if r:
			r.pop()
	else:
		r.append(c)
print(*r, sep="")

Solution (Python):
ans=[]
s=list(input())
for i in s:
  if i=="0":
    ans.append("0")
  elif i=="1":
    ans.append("1")
  else:
    if len(ans)>0:
      ans.pop()
print(''.join(ans))

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

Solution (Python):
s = input()
n = len(s)

ans = ''

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

print(ans)

Solution (Python):
t=[]
for x in input():
    if x=="B":
        try:t.pop()
        except:pass
    else:t.append(x)
print("".join(t))

Solution (Python):
s = list(input())
ans = ''
for i in s:
    if i == '0' or i == '1':
        ans += i
    elif i == 'B':
        ans = ans[:-1]

print(ans)

Solution (Python):


ss = input()

text = []
for s in ss:
    if s == 'B':
        if text != []:
            text.pop(-1)
    else:
        text.append(s)

print(''.join(text))

Solution (Python):
s = str(input())
ans = ""
for i in range(0,len(s),1):
    if s[i] == "0" or s[i] == "1":
        ans += s[i]
    else:
        ans = ans[:-1]
print(ans)

Solution (Python):
def b(x):
  if x=='':return''
  else:return x[:-1]
s,ans=input(),''
for i in range(len(s)):
  if s[i]=='B':ans=b(ans)
  else:ans+=s[i]
print(ans)

Solution (Python):
String = input()
result = ''
for char in String:
    if char == '0' or char == '1':
        result += char
    elif char == 'B':
        result = result[:-1]
print(result)

Solution (Python):
String = input()
result = ''
for char in String:
    if char == '0':
        result += char
    elif char == '1':
        result += char
    elif char == 'B':
        result = result[:-1]
print(result)

Solution (Python):
S = input()
ans = []

for s in S:
    if s == '0':
        ans.append('0')
    elif s == '1':
        ans.append('1')
    else:
        if len(ans) > 0:
            ans.pop()

print("".join(ans))

Solution (Python):


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

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())

rem = pow(10,9)+7




a = input()                                  







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

Solution (Python):
s = input()
ans = ''

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

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

Solution (Python):
S=str(input())
disp=''
for i in range(len(S)):
    if S[i]=='0': disp+='0'
    elif S[i]=='1': disp+='1'
    elif S[i]=='B' and disp=='': continue
    elif S[i]=='B' and disp!='': disp=disp[:-1]
print(disp)

Solution (Python):
string = []
S = input()
for i in S:
    if i == '0':
        string += '0'
    elif i == '1':
        string += '1'
    elif i == 'B':
        if len(string) == 0:
            pass
        else:
            del string[-1]
print(''.join(string))

Solution (Python):
t=""
for i in input():
    if i=="B":
        t=t[:-1]
    else:
        t+=i
print(t)

Solution (Python):
s = input()
l = []
for c in s:
  if c == 'B':
    if l != []:
      l.pop()
  else:
    l.append(c)
print(''.join(l))

Solution (Python):
s = list(input())

ans = []

for c in s:
    if c == 'B':
        if len(ans) > 0:
            del ans[len(ans) - 1]
    else:
        ans.append(c)

print(''.join(ans))

Solution (Python):
s = input()
 
ans = ""

for c in s:
    if c!="B":
        ans += c
    elif ans:       
        ans = ans[:-1]
print(ans)

Solution (Python):
list=list(input())
words=[]
word=""
for i in list:
  if i=="0" or i=="1":
    words.append(i)
  else:
    if words==[]:
      pass
    else:
      del words[-1]
for i in words:
  word+=i
print(word)

Solution (Python):
s = input()
p = ''
for i in range(len(s)):
    if s[i] == 'B':
        if 1 <= len(p):
            p = p[:-1]
    else:
        p += s[i]
print(p)

Solution (Python):
s=input()
ans=""
for x in s:
  if x == 'B' and len(ans)>0:
    ans=ans[:len(ans)-1]
  else:
    if x != 'B':
      ans+=x
print(ans)

Solution (Python):
def main():
    s = input() 
    out =''
    for i in s:
        if (out=='')and(i=='B'):
        
            pass
        elif (i=='B'):
            out = out[:-1] 
        else:
            out = out + i
    print(out)
main()

Solution (Python):
s = input()
ans = ""

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
ans = []
for c in S:
    if c == "B":
        if ans:
            ans.pop(-1)
    else:
        ans.append(c)
print("".join(ans))

Solution (Python):
s = list(str(input()))
lis = []
a = ""


for i in range(len(s)):
        if s[i] == "B":
                if len(lis) == 0:
                        continue
                else:
                        lis.pop()
        elif s[i] == "1":
                lis.append("1")
        else:
                lis.append("0")

for j in range(len(lis)):
        a = a + lis[j]

print(a)

Solution (Python):
s = input()
ans = ''
for x in s:
    if x =='B':
        ans = ans[:-1] if len(ans)>0 else ans
    else:
        ans += x
print(ans)

Solution (Python):
s = input()

ans = ""
for ch in s:
    if ch == "B":
        if ans != "":
            ans = ans[0:len(ans) - 1]
    else:
        ans = ans + ch

print(ans)

Solution (Python):
""" AtCoder """

s = input()
ans = ''

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

print(ans)

Solution (Python):



n=input()
ans=""
for i in range(len(n)):
    if n[i]=="0":
        ans+="0"
    elif n[i]=="1":
        ans+="1"
    elif n[i]=="B":
        if ans=="":
            pass
        else:
            ans=ans[:-1]

print(ans)

Solution (Python):
S = list(input().rstrip())
r = []
for i in range(len(S)):
    if S[i] == '0':
        r.append('0')
    elif S[i] == '1':
        r.append('1')
    elif S[i] == 'B':
        if 0 < len(r):
            del r[-1]


print(''.join(r))

Solution (Python):
a=''
for c in input():
	if c=='B':
		if len(a)>0:
			a=a[:-1]
	else:
		a+=c
print(a)

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

Solution (Python):
A=str(input())
A=list(A)
B=[]
for i in A:
  if i=="0":
    B.append("0")
  elif i=="1":
    B.append("1")
  elif i=="B":
    B=B[:-1]
print(''.join(B))

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