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):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 




 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    s = input()
    ans = ""
    
    for vol in s:
        if vol == "0":
            ans += "0"
        elif vol == "1":
            ans += "1"
        else:
            if len(ans) == 0:
                pass
            else:
                ans = ans[:-1]
                
    print(ans)
    
if __name__ == "__main__":
	main()

Solution (Python):
S = input()
ans = []
for s in S:
    if s=='B' and ans:
        ans.pop(-1)
    elif s!='B':
        ans.append(s)
print(''.join(ans))

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

for i in range(n):
    if s[i] in {"0", "1"}:
        w += s[i]
    elif s[i] == "B":
        if len(w) != 0:
            w = w[:-1]

print(w)

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

Solution (Python):
l=[i for i in input()]

ans_list=[]
for i in l:
  if i=='0' or i=='1':
    ans_list.append(i)
  else:
    if not ans_list==[]:
      ans_list.pop()
      
ans=''.join(ans_list)
print(ans)

Solution (Python):
lines = list(input())
answers = []
out = ""
for line in lines:
    if line == "0" or line == "1":
        answers.append(line)
    elif answers:
        answers.pop()
for answer in answers:
    out += answer
print(out)

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

for s in S:
  if s == "0" or s == "1":
    ans += s
  elif ans:
    ans = ans[0:len(ans)-1]

print(ans)

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

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

Solution (Python):


s = input()

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

print(ans)

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

Solution (Python):
if __name__ == "__main__":
    sl = list(input())

    text = ""

    for s in sl:
        if s == "0" or s == "1":
            text = text + s
        elif s == "B":
            if text != "":
                text = text[:-1]

    print(text)

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

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

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

print(s2)

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

Solution (Python):
s = input()
stack = []
for char in s:
    if char == "0" or char == "1":
        stack.append(char)
    else:
        if not stack:
            continue
        else:
            stack.pop()
print(*stack,sep="")

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

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

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

Solution (Python):
s = input()
o = []
for _s in s:
    if _s in ["0", "1"]:
        o.append(_s)
    else:
        if len(o) > 0:
            o.pop()
print("".join(o))

Solution (Python):
S = input()
editor = []
for s in S:
  if s=="0":
    editor.append(s)
  elif s=="1":
    editor.append(s)
  else:
    if len(editor)!=0:
      editor.pop()
print(*editor,sep="")

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

Solution (Python):



s = input()


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


print(*ans, sep='')

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

for i in s:
    if i=='0' or i=='1':
        ans+=i
    if i=='B' and len(ans)!=0:
        ans.pop()
print(''.join(ans))

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

Solution (Python):
S = ""
for i in input():
  if i == "B" and S == "":
    pass
  elif i == "B":
    S = S[0:-1]
  else:
    S += i
print(S)

Solution (Python):
N = list(input())
L = []
for i in N:
    try:
        if i == "0":
            L.append("0")
        elif i == "1":
            L.append("1")
        else:
            L.pop(-1)
    except IndexError:
        pass
print("".join(L))

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

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())
ans = []
for  i in s:
	if i == 'B' and 0 < len(ans):
		ans.pop(len(ans)-1)
	elif i== 'B' and 0==len(ans):
		continue
	else:
		ans.append(i)
print(''.join(ans))

Solution (Python):
s=input()
stack=[]
for i in s:
  if i=='B':
    if stack:
      stack.pop()
    else:
      pass
  else:
    stack.append(i)
print(''.join(stack))

Solution (Python):
a = []
for i in input():
  if i == '0':
    a.append('0')
  elif i == '1':
    a.append('1')
  else:
    try:
      a.pop()
    except:
      pass
print(''.join(a))

Solution (Python):

s = list(input())
ret = []

for c in s:
    if c == '0' or c == '1':
        ret.append(c)

    else:
        if len(ret) > 0:
            ret.pop()

print(*ret, sep="")

Solution (Python):
s=input()
for _ in range(10):
  s=s.replace("0B","")
  s=s.replace("1B","")
s=s.replace("B","")
print(s)

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

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

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

Solution (Python):
S = input()
rets = []
for s in S:
    if s=="0":
        rets.append("0")
    elif s=="1":
        rets.append("1")
    elif s=="B":
        if len(rets) > 0:
            rets.pop(-1)
print("".join(rets))

Solution (Python):
S=input()
ans=[""]*10
i=0
for s in S:
  if s=="B":
    if i==0:
      continue
    else:
      i-=1
      ans[i]=""
  else:
    ans[i]=s
    i+=1
print("".join(ans))

Solution (Python):
s = input()

line = []
for ch in s:
  if ch=='0' or ch=='1':
    line.append(ch)
  else: 
    if line:
      line.pop()
print(''.join(line))

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

for i in range(len(s)):
    if s[i] == '0':
        l.append(0)
    elif s[i] == '1':
        l.append(1)
    elif s[i] == 'B':
        if len(l) > 0:
            l.pop()

print(''.join(map(str, l)))

Solution (Python):
S=input()

result=[]

for s in S:
  
  if s=="B":
    if len(result)>0:
      
      result.pop()
  else:
    result.append(s)

print(*result,sep="")

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

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

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

Solution (Python):
S=input()
l=[]
for s in S:
    if s!='B':
        l.append(s)
    else:
        if l==[]:
            pass
        else:
            l.pop()
print(*l,sep='')

Solution (Python):
s = input()
X = list(s)
Y = []

for i in range(len(X)):
    if X[i] != 'B':
        Y.append(X[i])
    else:
        if Y != []:
            Y.pop(-1)

ans = ''
for i in range(len(Y)):
    ans += Y[i]

print(ans)

Solution (Python):
s = input()
q = []
for si in s:
    if si == 'B':
        if len(q) != 0:
            q.pop()
        else:
            pass
    else:
        q.append(si)

print("".join(q))

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

Solution (Python):


if __name__ == '__main__':
    S = input()

    out = []
    for s in S:
        if s=='B':
            try:
                out.pop(-1)
            except:
                pass
        else:
            out.append(s)

    print(''.join(out))

Solution (Python):
S = input()
str = []
result = ""
flg = 0
for i in range(len(S)):
    if S[i] == 'B':
        result = result[:-1]
    else:
        result += S[i]
print(result)

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

for s in S:
    if s == 'B' and ans:
        ans.pop()
    elif s != 'B':
        ans.append(s)

print(*ans, sep='')

Solution (Python):
S = input()
L = []
for c in S:
  if c == "0":
    L.append(c)
  elif c == "1":
    L.append(c)
  else:
    if len(L) > 0:
      L.pop()
r = "".join(L)
print(r)

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

Solution (Python):
S = input()

t = ""
for i in range(len(S)):
  if S[i] == "B":
    if t != "":
      t = t[:-1]
  else:
    t += S[i]
print (t)

Solution (Python):
s=input()

out=[]
for c in list(s):
  if c=='0':
    out.append('0')
  elif c=='1':
    out.append('1')
  else:
    if len(out)>0:
      del out[-1]
print(''.join(out))

Solution (Python):
def B_UnhappyHacking():
    S = input()
    ans = []
    for s in S:
        if "B" == s:
            ans = ans[:-1]
        else:
            ans.append(s)
    print(*ans,sep="")
    
if __name__ == "__main__":
    B_UnhappyHacking()

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


a = []


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

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


a = []


for i in s:
 
  if i == 'B' and s.index(i) == 0:
    a = a[:-1]
  elif i == 'B':
    a = a[:-1]
    
  else:
    a.append(i)
  
    
print(''.join(a))

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

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

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

for i in  s:
  if i == '0':
    arr.append('0')
  elif i == '1':
    arr.append('1')
  elif i == 'B':
    if len(arr) > 0:
      arr.pop(-1)
  else:
    pass
  
print(''.join(arr))

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

Solution (Python):
s = input()
answer = []
cursor = 0


for i in range(len(s)):
  if s[i] == "0" or s[i] == "1":
    
    answer.append(s[i])
    cursor += 1
  elif cursor > 0:
    del answer[-1]
    cursor -= 1
for i in range(cursor):
  print(answer[i], end = "")

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

Solution (Python):
s = input()

rslt = []
for c in s:
  if c in ['0', '1']:
    rslt.append(c)
  elif rslt:
    rslt = rslt[:-1]
print(''.join(rslt))

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

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

length = len(s)

for i in range(length):
	if s[i] == 'B':
		if len(syamu) > 0:
			syamu.pop()
	else:
		syamu.append(s[i])

print("".join(syamu))

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 ans==[]:
            continue
        else:
            ans.pop(-1)
print(''.join(ans))

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

Solution (Python):
s = input()
n = len(s)
t = ''
for i in range(n):
  if s[i] == 'B' and t == '':
    pass
  elif s[i] == 'B':
    t = t[:-1]
  else:
    t += s[i]
print(t)

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

Solution (Python):

s = input()
a = []

for c in s:
    if c == '1' or c == '0':
        a.append(c)
    else:
        if len(a) > 0:
            a.pop(-1)

print(''.join(a))

Solution (Python):


s = input()
n = len(s)
s_list = []

for i in range(0, n):
    if s[i] == 'B':
        if len(s_list) == 0:
            continue
        else:
            s_list.pop(-1)
    else:
        s_list.append(s[i])

S = ''
for i in range(0, len(s_list)):
    S = S + s_list[i]

print(S)

Solution (Python):


import numpy as np
import scipy as sp

s = input()
n = len(s)
s_list = []

for i in range(0, n):
    if s[i] == 'B':
        if len(s_list) == 0:
            continue
        else:
            s_list.pop(-1)
    else:
        s_list.append(s[i])

S = ''
for i in range(0, len(s_list)):
    S = S + s_list[i]

print(S)

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

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


for i in range(len(s)): 
    if len(a)>0 and s[i]=="B":
        a.pop(-1)
    elif s[i]=='0':
        a.append('0')
    elif s[i]=='1':
        a.append('1')
answer=""
for i in range(len(a)):
    answer += a[i]

print(answer)

Solution (Python):


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

Solution (Python):
s = input()
ans = []
for p in s:
    if p == '0':
        ans.append('0')
    elif p == '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 len(ans) == 0:
      pass
    else:
      ans = ans[:-1]
  else:
    ans += i
print(ans)

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

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

Solution (Python):
S = input()

t = ""
for i in range(len(S)):
  if S[i] == "B":
    if t != "":
      t = t[:-1]
  else:
    t += S[i]
print (t)

Solution (Python):

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

Solution (Python):
s = input()
str = ""
for i in s:
    if i == "0" or i == "1":
        str += i
    elif i == "B" and str != "" :
        str = str[:-1]
print(str)

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



print(str)

Solution (Python):
s=input()
result=""
for c in list(s):
  if c=="0"or c=="1":
    result=result+c
  elif c=="B" and result!="":
    result=result[:-1]
print(result)

Solution (Python):
s = input()
ans = ""
for a in list(s):
    if a=="B":
        if len(ans)>0:
            ans = ans[0:-1]
    else:
        ans += a

print(ans)

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

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

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):
s = input()
ans = ""
for i in range(len(s)):
    if s[i] == "B" and len(ans) > 0:
        ans = ans[0:len(ans)-1]
    elif s[i] == "1":
        ans = ans + "1"
    elif s[i] == "0":
        ans = ans + "0"
print(ans)

Solution (Python):
nyu=input()
shutu=[]
for i in nyu:
	if i=="B":
		if len(shutu)!=0:
			shutu.pop(-1)
	else:
		shutu.append(i)
kekka="".join(shutu)
print(kekka)

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

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

Solution (Python):
s = input()
ans = []
for x in s:
    if x == 'B' and len(ans):
        ans.pop()
    elif x == 'B' and len(ans) == 0:
        pass
    else:
        ans.append(x)
ans_s = ''
for x in ans:
    ans_s += x
print(ans_s)

Solution (Python):
S = list(raw_input())
ans = ""
for i in range(0,len(S)):
    if S[i] == "0":
        ans += "0"
    elif S[i] == "1":
        ans += "1"
    else:
        ans = ans[:len(ans)-1]
print ans

Solution (Python):
s = input()

while "B" in s:
    if s[0] == "B":
        s = s[1:len(s)+1]
    s = s.replace("0B", "")
    s = s.replace("1B", "")

print(s)

Solution (Python):
a = []
for c in input():
    if c in '01':
        a.append(c)
    else:
        a = a[:-1]
print("".join(a))

Solution (Python):
s = input()

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

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

Solution (Python):
s_list = list(input())
ans = []
for s in s_list:
    if s=='0':
        ans.append(0)
    elif s=='1':
        ans.append(1)
    if s=='B':
        if len(ans)>0:
            del ans[-1]
print(''.join(map(str,ans)))

Solution (Python):
S = input()
keybord = [s for s in S]
editor = ''
for i in range(len(S)):
    if keybord[i] == '0':
        editor += '0'
    elif keybord[i] == '1':
        editor += '1'
    else:
        if editor == '':
            continue
        else:
            editor = editor[:-1]

print(editor)

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

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

Solution (Python):
strs = input()

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

Solution (Python):
x = input()
while x.count('B') > 0:
  x = x.replace('0B','')
  x = x.replace('1B','')
  if x[0] == 'B':
    x = x.replace('B','')
else:
  print(x)

Solution (Python):
x = input()
while x.count('B') > 0:
  x = x.replace('0B','')
  x = x.replace('1B','')
  if x[0] == 'B':
    x = x.replace('B','')
else:
  print(x)

Solution (Python):

s = input()

text = ''
for i in s:
    if i == '1':
        text += '1'
    elif i == '0':
        text += '0'
    elif i == 'B' and text:
        text = text[:-1]
print(text)

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(300000)


def solve(s: str):
    ret = ''
    for c in s:
        if c == 'B':
            if len(ret) > 0:
                ret = ret[:-1]
        else:
            ret += c
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  
    solve(s)

if __name__ == '__main__':
    main()

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

string=[]

for i, x in enumerate(s_list):
    if x=='0':
        string.append('0')
    if x=='1':
        string.append('1')
    if x=='B':
        if len(string) != 0 :
            string.pop()
        else: pass
        
string_out=''.join(string)

print(string_out)

Solution (Python):
s=input()


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

mojiretu = ' '
 
for x in result:
    mojiretu += x
    
print(mojiretu)

Solution (Python):

import sys


def main():
    data = list(input())
    ans = []
    for ele in data:
        if ele == 'B' and len(ans) > 0:
            ans.pop(-1)
        elif ele == '1':
            ans.append('1')
        elif ele == '0':
            ans.append('0')
        

    print(''.join(ans))

if __name__ == '__main__':
    main()

Solution (Python):
s=str(input())
a=[]
for i in s:
    if i=='0':
        a.append('0')
    elif i=='1':
        a.append('1')
    else:
        if len(a)!=0:
            del a[-1]
for i in a:
    print(i,end='')

Solution (Python):


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

print(result)

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

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

for i in m[::-1]:
    print(i, end='')

Solution (Python):
lst=""
i=list(input())
for j in i:
    if j=="0"or j=="1":
        lst+=j
    elif j=="B"and lst!=[]:
        lst=lst[:-1]
print(lst)

Solution (Python):
s = input()
ans = ''
for c in s:
    if c == 'B':
        if ans:
            ans = ans[:-1]
    else:
        ans = ans + c
print(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')
    else:
        if len(ans) != 0:
            ans.pop(-1)

print(''.join(ans))

Solution (Python):
s = str(input())
ans = ''
for char in s:
  if char == 'B':
    if len(ans) == 0:
      continue
    else:
      ans = ans[:-1]
  elif char == '0':
    ans = ans + '0'
  else:
    ans = ans + '1'
print(ans)

Solution (Python):
def main():
    s = input()
    ans = []
    for op in s:
        if op == '0':
            ans.append(op)
        elif op == '1':
            ans.append(op)
        else:
            if len(ans) > 0:
                ans.pop()
    print(*ans, sep='')
if __name__ == '__main__':
    main()

Solution (Python):
S=input()
stream=""
for s in S:
    if s=="0": stream+="0"
    elif s=="1": stream+="1"
    elif s=="B": stream=stream[:-1]
print(*stream, sep="")

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

for i in range(len(s)):
    if(s[i] == "B"):
        if(len(t) > 0):
            del t[-1]
    else:
        t.append(s[i])

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

Solution (Python):
s = list(input())
ans = ""
for c in s:
  if c == "0" or c == "1":
    ans += c
  elif c == "B" and ans != "":
    ans = ans[:len(ans) - 1]

print("{}".format(ans))

Solution (Python):
a = input()
ans = ""
for c in a:
  if (c == '0') | (c == '1'):
    ans += c
  else:
    if not ans == "":
      ans = ans[:len(ans)-1]
print(ans)

Solution (Python):
S=input()
li=[]
for s in S:
  if s=="B":
    try:
      li.pop(-1)
    except:
      pass
  else:
    li.append(s)
print("".join(li))

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

for i in s:
  if i=="B":
    if z:
      z.pop()
  else:
    z.append(i)

print("".join(z))

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

for i in s:
  if i=="0" or i=="1":
    z.append(i)
  elif i=="B" and len(z)!=0:
    z.pop()
else:
  print("".join(z))

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

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

Solution (Python):

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

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

print(ans)

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

Solution (Python):
lst = list(input())
st = ''
for i in lst:
  if i != 'B':
    st += i
  elif st != '' and i == 'B':
    st = st[:len(st) - 1]

print(st)

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

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

ans = ""

for i in s:
  if i == "0":
    ans += "0"
  elif i == "1":
    ans += "1"
  else:
    try:
      ans = ans[:-1]
    except:
      continue

print(ans)

Solution (Python):
s = [i for i in input()]
ans = []

for c in s:
    if c is '0' or c is '1': ans.append(c)
    else:
        try:
            ans.pop(-1)
        except: pass
print(''.join(ans))

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

Solution (Python):
s = list(input())
a =""
for i in range(len(s)):
    if s[i] == "B":
        new_a = a[0:len(a)-1]
        a = new_a
    else:
        new_a = str(a) + s[i]
        a = new_a
print(a)

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

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):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a = II()
    ans = 0
    for i in range(a + 1):
        ans += i
    print(ans)
    return


def B():
    s = S()
    ans = []
    for si in s:
        if si == "B":
            ans = ans[:-1]
            continue
        ans.append(si)
    print("".join(ans))
    return


def C():
    return


def D():
    return


if __name__ == '__main__':
    B()

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(0, len(S)):
	if S[i] == 'B':
		if ans != '':
			ans = ans[:len(ans)-1]
	else:
		ans = ans + S[i]
print(ans)

Solution (Python):

S = input()


lis = []


for s in S:

    if s == "0":
        lis.append("0")

    elif s == "1":
        lis.append("1")

    elif len(lis) > 0:

        del lis[-1]


print ("".join(lis))

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

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 = list(input())
str = ""

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

print(str)

Solution (Python):

s = [ n for n in input()]

ans = []

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

print("".join(ans))