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):
s = list(input())
output = []
for i in range(len(s)):
    if s[i] == "0":
        output.append("0")
    elif s[i] == "1":
        output.append("1")
    else:
        if len(output) > 0:
            output.pop()
        else:
            pass
print("".join(output))

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

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

Solution (Python):
s = input()

i = list(s)

answer = []

for num in i:
    if num == '0':
        answer.append(num)
    elif num == '1':
        answer.append(num)
    else:
        if answer == []:
            continue
        else:
            answer.pop()

for num in answer:
    print(num,end='')

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

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

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

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

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

    
print(ans)

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

resolve()

Solution (Python):
S = input()
ans = ""
flag = 0
for s in S[::-1]:
  if s == "B":
    flag += 1
    continue
  if flag:
    flag -= 1
    continue
  ans += s
print(ans[::-1])

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

Solution (Python):
s = input()

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

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

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

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

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

Solution (Python):

import sys
from collections import deque
input = sys.stdin.readline
s = list(input())
d = deque()
for i in s:
  if (i=='B')&(len(d)!=0):
    d.pop()
  elif (i=='B')&(len(d)==0):
    continue
  else:
    d.append(i)
print(''.join(list(d)))

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

ans = [] 

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

Solution (Python):
S = input()

res = []
for s in S:
    if s == "0":
        res.append("0")
    elif s == "1":
        res.append("1")
    else:
        if res:
            res.pop()

print("".join(res))

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

Solution (Python):
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

d = deque()

for i in input():
  if i=="0":
    d.append("0")
  elif i=="1":
    d.append("1")
  elif d:
    d.pop()

while d:
  print(d.popleft(),end="")
print()

Solution (Python):
def main():
    from collections import deque
    s = list(input())
    ans = deque([])
    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))

main()

Solution (Python):
import collections

def resolve():
    '''
    code here
    '''
    s = collections.deque([item for item in input()])
    que = collections.deque()

    while s:
        try:
            temp = s.popleft()
            if temp == 'B':
                que.pop()
            else:
                que.append(temp)
        except:
            pass

    print(''.join(list(que)))


if __name__ == "__main__":
    resolve()

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

for i in s:
    if i=='0':
        ans.append('0')
    elif i=='1':
        ans.append('1')
    elif i=='B' and ans:
        ans.pop()
print(''.join(ans))

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

Solution (Python):
from collections import deque
s=input()

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

L="".join(d)
print(L)

Solution (Python):
def main():
    a=[]
    for s in input():
        if s == "B":
            if len(a) > 0:
                a.pop()
        else:
            a.append(s)
    print("".join(a))
    pass

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
st = ''
for si in S:
    if si == '0':
        st += '0'
    if si == '1':
        st += '1'
    if si == 'B':
        if st == '':
            pass
        else:
            st = st[0:-1]
print(st)

Solution (Python):
s=list(input())
out=[]
for i in s:
  if i=="B":
    if out==[]:
      continue
    out.pop()
  else:
    out.append(i)
ou=""
for i in out:
  ou+=i
print(ou)

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,w in enumerate(s):
    if w == "B" and len(ans) != 0:
        ans.pop(-1)
    elif w == "0" or w == "1":
        ans.append(w)
print("".join(ans))

Solution (Python):
s = input()
ans = list()
for ss in s:
  if ss == '0':
    ans.append('0')
  elif ss == '1':
    ans.append('1')
  else:
    if ans:
      ans.pop(-1)

print(''.join(ans))

Solution (Python):
s = input()

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

print(ans)

Solution (Python):
S = input()

ret = ""
for i in S:
    if i != "B":
        ret += i
    else:
        ret = ret[:-1]

print(ret)

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

for s in S:
    if s == "B":
        ans = ans[:len(ans) - 1]
    else:
        ans += s
        
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 ans == '':
            continue
        else:
            ans = ans[:-1]
print(ans)

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

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

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

print(''.join(t))

Solution (Python):
def key():
    a=input()
    b=''
    for i in range(0,len(a)):
        if a[i]=='0':
            b+='0'
        elif a[i]=='1':
            b+='1'
        elif a[i]=='B':
            if len(b)==0:
                continue
            else:
                b=b[0:-1]
    print(b)

key()

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

Solution (Python):
def hi():
  a = input()
  key = ""
  for i in range(len(a)):
    if a[i]=='0':
      key += '0'
    elif a[i]=='1':
      key += '1'
    elif a[i]=='B':
      if len(key) == 0:
        continue
      else:
        key = key[0:-1]
  print(key)

hi()

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

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

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

Solution (Python):
s = list(str(input()))
answer = ""

for i in s:
    if i == "0":
        answer = answer + "0"

    elif i == "1":
        answer = answer + "1"

    elif i == "B":
        answer = answer[:-1]

print(answer)

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

print(r)

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

for i in s:
  if i == 'B' and stack:
    stack.pop()
  elif i != 'B':
    stack.append(i)
print(''.join(stack))

Solution (Python):
s = input()
ans = []
for c in s:
    if c == '0':
        ans.append('0')
    elif c == '1':
        ans.append('1')
    else:
        if ans:
            ans.pop()

print(''.join(ans))

Solution (Python):
s = input()

list = []

for i in s:
    if i == "0":
        list.append(i)
    elif i == "1":
        list.append(i)
    elif i == "B" and list != []:
        list.pop(-1)
    else:
        continue

print("".join(list))

Solution (Python):

input = input()

text = ''


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


print(text)

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

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

for s in ss:
    if s == '0':
        ans.append('0')
    elif s == '1':
        ans.append('1')
    elif s == 'B' and len(ans) != 0:
        ans.pop()

print(''.join(ans))

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

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

for x in s:
    if x == "0":
        t.append("0")
    elif x == "1":
        t.append("1")
    else:
        if len(t) > 0:
            t.pop()
print(*t,sep='')

Solution (Python):
s = input()

t = []
for c in s:
    if c == "B":
        if len(t) != 0:
            t.pop()
    else:
        t.append(c)
print("".join(t))

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

for s in S:
  if s=="0" or s=="1":
    A.append(s)
  else:
    A = A[:len(A)-1]
    
print(*A,sep="")

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    s = input()
    ans = []
    for i in range(len(s)):
        if s[i] == 'B':
            if ans:
                ans.pop()
        else:
            ans.append(s[i])
    ans = "".join(ans)
    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):
from collections import deque
s = input()
de = deque()
for i in s:
    if i == "0":
        de.append("0")
    elif i == "1":
        de.append("1")
    elif i == "B":
        if len(de) != 0:
            de.pop()
ans = "".join(de)
print(ans)

Solution (Python):


s = list(str(input()))
c = []

for x in s:
    if x != 'B':
        c.append(x)
    elif x == 'B' and c != []:
        c.pop()
    else:
        continue


print(*c, sep='')

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
from fractions import gcd
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) 
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = S()
    L = [i for i in N]
    ans = []

    for i, num in enumerate(L):
        if(num != "B"):
            ans.append(num)
        if(ans != [] and num == "B"):
            ans.pop(-1)

    print("".join(ans))

if __name__ == '__main__':
    main()

Solution (Python):
s = input()

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

print(ans)

Solution (Python):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement




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

Solution (Python):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement




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

Solution (Python):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement




s = input()
ans = []
for x in s:
    if x=='0': ans.append('0')
    elif x == '1': ans.append('1')
    else:
        if len(ans) == 0: pass
        else: ans.pop()
for t in ans: print(t, end = "")

Solution (Python):
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[len(b)-1]
        
print("".join(b))

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

Solution (Python):
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()
print(''.join(ans))

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

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

    elif s[i] == "1":
        out = out + "1"

print(out)

Solution (Python):

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

print(''.join(s_))

Solution (Python):
def display():
    s = input()
    out = []
    final = ''

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

        if key == '0':
            out.append('0')
        if key == '1':
            out.append('1')
        if key == 'B':
            if len(out) > 0:
                out.pop()
        
    for i in range(len(out)):
        final = final + out[i]
    
    print(final)

            

display()

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

for a in s:
    if a=="0" or a=="1":
        ans+=a
    else:
        ans=ans[:-1]
print(ans)

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

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

Solution (Python):
s=input()
result = []
for i in s:
  if i=='0':
    result.append('0')
  elif i=='1':
    result.append('1')
  elif i=='B':
    if not result:
      continue
    result.pop()
print(''.join(result))

Solution (Python):
a = ""

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

print(a)

Solution (Python):
a = ""

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

print(a)

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

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

Solution (Python):
from collections import deque

s = list(input())
l = deque()

for i in s:
    if i == 'B':
        if l:
            l.pop()
        else:
            continue
    else:
        l.append(i)

print("".join(l))

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

for c in s:
    if c == 'B':
        if len(txt):
            txt.pop()
    else:
        txt.append(c)

print(''.join(txt))

Solution (Python):
S = list(input())
A = ''
for s in S:
    if s == '0' or s == '1':
        A = A + s
    else:
        if len(A) == 0:
            continue
        A = A[:len(A) - 1]
print(A)

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

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

print(''.join(ans))

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)

Solution (Python):
import sys
INF = 1 << 60
MOD = 10**9 + 7 
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    stack = []
    for c in input():
        if c != 'B':
            stack.append(c)
        else:
            if stack:
                stack.pop()
    print(''.join(stack))
resolve()

Solution (Python):
def resolve():
    s = input()
    lis = []
    ans = ""
    for i in range(len(s)):
        if s[i] != "B":
            lis.append(s[i])
        elif s[i] == "B" and len(lis) != 0:
            lis = lis[:-1]
    for j in range(len(lis)):
        ans += lis[j]
    print(ans)
resolve()

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

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

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

Solution (Python):
st = str(input())

lst = []
for i in range(len(st)):
    if st[i] == 'B':
        if len(lst) > 0:
            lst.pop()
    else:
        lst.append(st[i])
print(''.join(lst))

Solution (Python):
s=input()
ans=[]
for x in s:
    if x=='B' and len(ans)>0:
        del(ans[len(ans)-1])
    elif x!='B':
        ans.append(x)
for x in ans:
    print(x,end="")

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

Solution (Python):
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    S = input().strip()
    stack = []
    for s in S:
        if s == 'B':
            if stack:
                stack.pop()
        else:
            stack.append(s)
    return ''.join(stack)


if __name__ == '__main__':
    print(solve())

Solution (Python):
def mi():
    return map(int, input().split())

def ii():
    return int(input())

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

if __name__ == '__main__':
    main()

Solution (Python):
order = input()

order = list(order)

text = []

for o in order:
    if o == "0":
        text += "0"

    elif o == "1":
        text += "1"

    elif o == "B":
        if text != []:
            del text[-1]

print("".join(text))

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

Solution (Python):
from collections import deque
s = input()

stack = deque()
for i in s:
  if i == "0" or i == "1": stack.append(i)
  else:
    if len(stack) > 0:
      stack.pop()
print(*stack, sep = "")

Solution (Python):
s = input()

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

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

ans = []

for i in s:
  if i is not 'B':
    ans.append(i)
  elif len(ans) != 0:
    ans.pop()

  else:
    pass

print(''.join(ans))

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

print(''.join(ans))

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

for i in range(len(s)):
    if s[i] == 'B' and res:
        res.pop()
    elif s[i] == 'B':
        continue
    else:
        res.append(s[i])

print(''.join(res))

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

Solution (Python):

s = input()

result = []

for i in s:
    if i == '0':
        result.append('0')
    elif i == '1':
        result.append('1')
    else:
        if len(result) == 0:
            continue
        else:
            result.pop(-1)
            
print("".join(result))

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

Solution (Python):
import sys
input = sys.stdin.readline


def read():
    S = input().strip()
    return S,

def solve(S):
    k = []
    for s in S:
        if s != "B":
            k.append(s)
        elif len(k) > 0:
            k.pop()
    return "".join(k)

if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Solution (Python):
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	s_list = list(S())
	ans = ''
	for s in s_list:
		if s == 'B':
			if len(ans) > 0:
				ans = ans[:-1]
		else:
			ans += s
	print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
'''     
        
        
        

import sys
import math


def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMODPR = 998244353;

ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
    sys.stdin  = open("input.txt","r")
    sys.stdout = open("output.txt","w")
    sys.stderr = open("output.txt","w")


s= input()
li = []
for i in s:
    if i == 'B':
        try: li.pop()
        except: pass
    else:
        li.append(i)
print("".join(li))

'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Solution (Python):
s = input()
from collections import deque
d = deque()
for elem in s:
    if elem == '0':
        d.append(elem)
    elif elem == '1':
        d.append(elem)
    elif elem == 'B' and len(d) > 0:
        d.pop()

print(*d, sep='')

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

nows = []

for x in s:
    if x == "B":
        if len(nows) == 0:
            continue
        else:
            nows.pop(-1)
    else:
        nows.append(x)


print("".join(nows))

Solution (Python):
import copy
s=str(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):
from collections import deque

S=input()



d=deque()
for i in range(len(S)):
    if S[i]!="B":
        d.append(S[i])
    elif len(d)!=0 and S[i]=="B":
        tmp=d.pop()

    
Z=list(d)
Z=[str(a) for a in Z]
Z="".join(Z)
print(Z)

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

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

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

Solution (Python):
s = list(input())
ans = []
for v in s:
    if v == '0':
        ans.append('0')
    elif v == '1':
        ans.append('1')
    elif v == 'B':
        if len(ans) != 0:
            ans.pop()
print(''.join(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 = []
for c in input():
  if c == 'B':
    if S:
      S.pop()
  else:
    S.append(c)
print(*S, sep='')

Solution (Python):

"""
Created on Thu Jun 11 17:09:47 2020

@author: sd18016
"""

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:
            pass
        else:
            ans.pop()

print("".join(ans))

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

print(''.join(l))

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

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 s:
    if i=="B":
        ans = ans[:-1]
    else:
        ans += i
print(ans)

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

print(b)

Solution (Python):
import os, sys, re, math

S = input()

ret = ""
for s in S:
    if s == '0':
        ret = ret + s
    if s == '1':
        ret = ret + s
    if s == 'B':
        ret = ret[:len(ret)-1]

print(ret)

Solution (Python):
S = list(input())
out = []
for x in S:
    if x == "B":
        if len(out) != 0:
            out.pop(-1)
    else:
        out.append(x)
print("".join(out))

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

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

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

Solution (Python):
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)

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

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