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

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

print(ans)

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

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

stack = []

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

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

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

ans=[]

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

Solution (Python):
first_str =input()

input_list = list(first_str)

total_list = list()

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

Solution (Python):
s = input()

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = []
for v in input().strip():
    if v != 'B':
        s.append(v)
    else:
        if s:
            s.pop()
print(''.join(s))

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

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

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

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

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

    print(ans_str)



if __name__ == '__main__':
    main()

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

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

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):
s = input()
a = []
for c in s:
    if c in ['0', '1']:
        a.append(c)
    else:
        if len(a) != 0:
            a.pop()
print(''.join(a))

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 s[i] == "B" and len(ans) > 0 :
        del ans[-1]
print("".join(ans))

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

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

    return result

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

if __name__ == '__main__':
    main()

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

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

print(ans)

Solution (Python):
import math
from datetime import date

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

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

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

	print(line)
	
main()

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

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

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

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

print(res)

Solution (Python):

S = input()

STR = ""
for i in S:
    STR = STR + i
    if i == "B" and STR == "":
        STR = ""
    elif i == "B":
        STR = STR[:len(STR) - 2]
print(STR)

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

Solution (Python):

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

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

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

Solution (Python):
from collections import deque

S = input()

ans = deque([])

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

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

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

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

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

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

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

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

Solution (Python):
s = input()

stack = []

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

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

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

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 != '':
			ans = ans[:-1]    
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 != '':
            ans = ans[:-1]
            
print(ans)

Solution (Python):


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

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

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

from collections import deque

q = deque()

s = input()
for operation in s:
    if operation == "0":
        
        q.append("0")

    elif operation == "1":
        
        q.append("1")

    elif operation == "B":
        
        
        
        try:
            q.pop()
        except IndexError:
            pass 


answer = ""
for i in q:
    answer = answer + i

print(answer)

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

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

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

Solution (Python):

import sys


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



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

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

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) >= 1:
      ans = ans[:-1]
print(ans)

Solution (Python):
s = input()
stack = []
for i in range(len(s)):
    if s[i] == "B":
        if not stack:
            continue
        stack.pop()
    else:
        stack.append(s[i])

print("".join(stack))

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

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

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

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

Solution (Python):


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

print(ret)

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

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

print(''.join(a))

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

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

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

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

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

Solution (Python):
x=input()
z=''

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

print(z)

Solution (Python):
from collections import deque


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


if __name__ == "__main__":
    main()

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

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


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

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

stack = []

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

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

s = input()
t = []
for i in range(len(s)):
    if s[i]=='B':
        if len(t)>0:
            t = t[:len(t)-1]
    else:
        t.append(s[i])
print(''.join(t))

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

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(-1)
print(*ans,sep="")

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

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

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

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

if __name__ == "__main__":
    main()

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

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

Solution (Python):
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()

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

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

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

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

Solution (Python):

s = input()
len_s = len(s)

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

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

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

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

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

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

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

Solution (Python):
S = input()

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

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

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

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

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

Solution (Python):
S = list(input())
Ans = []
for s in S:
    if s == "0":
        Ans.append("0")
    elif s == "1":
        Ans.append("1")
    else:
        if Ans:
            Ans.pop()
print("".join(Ans))

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

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

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

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

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=list(input())
ans=list()
for i in s:
    if i=="0":
        ans.append(0)
    elif i=="1":
        ans.append(1)
    else:
        try:
            ans.pop(-1)
        except:
            pass
for i in ans:
    print(i,end="")
print()

Solution (Python):
strs = []
s = list(input())
for num in s:
    if num == "0":
        strs.append("0")
    elif num == "1":
        strs.append("1")
    elif num == "B" and strs:
        strs.pop(len(strs)-1)

print("".join(strs))

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect














import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7


from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
s = input()
ans = ""
for i in range(len(s)):
    if s[i] == '0':
        ans += "0"
    elif s[i] == '1':
        ans += "1"
    else:
        ans = ans[:-1]
print(ans)

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

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

Solution (Python):
from collections import deque
S = input()
L = len(S)
d = deque()
for i in range(L):
    if S[i] == "0":
        d.append("0")
    elif S[i] == "1":
        d.append("1")
    else:
        if len(d) != 0:
            d.pop()

ans = ''.join(d)
print(ans)

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

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

ans = []
for t in s:
  if t == "0":
    ans.append("0")
  elif t == "1":
    ans.append("1")
  elif t == "B" and ans != []:
    ans.pop(-1)
print("".join(ans))

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

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

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

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

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

print(ans)

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

Solution (Python):

from collections import deque
S = input()

ans = deque([])
for s in S:
    if s == 'B' and len(ans) >= 1:
        ans.pop()
    elif s == '0' or s == '1':
        ans.append(s)
print(''.join(ans))

Solution (Python):
from collections import deque
S = input()
q = deque()

for s in S:
    if s == "B":
        if len(q) != 0:
            q.pop()
    else:
        q.append(s)
print("".join(q))

Solution (Python):
str = input()
ans = list()
for s in str:
    if s == 'B':
        if ans:
            ans.pop()
        continue
    else:
        ans.append(s)
print("".join(ans))

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

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

print(s)

Solution (Python):
from collections import deque

S = input()
d = deque()

for s in S:
    if s == 'B':
        if len(d) > 0:
            d.pop()
    else:
        d.append(s)
print("".join(map(str, d)))

Solution (Python):
X = input()
text = []

for i in X:
    if i == 'B':
        text = text[:-1]
    else:
        text.append(i)
print(*text, sep='')

Solution (Python):


import sys



def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    ans = []
    for s in S:
        if s != "B":
            ans.append(s)
        else:
            if ans:
                ans.pop()
    print("".join(ans))

    return


if __name__ == "__main__":
    main()

Solution (Python):
S = input()
disp = []
for s in S:
    if s=="B":
        if not disp:
            continue
        else:
            disp.pop()
    else:
        disp.append(s)
print("".join(disp))

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

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

for i in s:
    if i == '0':
        a.append('0') 
    elif i == '1':
        a.append('1')
    elif i == 'B':
        if len(a) ==0:
            continue
        else:
            del a[-1]
        

print(''.join(a))

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

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

Solution (Python):
s = input()

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

Solution (Python):
import bisect,collections,copy,itertools,math,string
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():
    s = S()

    while "B" in s:
        index = s.index("B")
        if index == 0:
            s = s.replace("B","",1)
        else:
            before = s[index-1]
            delete = before+"B"
            s = s.replace(delete,"",1)
    print(s)
main()

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

Solution (Python):
s = input()

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

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

Solution (Python):
s=list(input())
x=[]
for i in s:
  if i=="0" or i=="1":
    x.append(i)
  else :
    if not x:
      pass
    else:
   	  del x[-1]
print("".join(x))

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

print(str)

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

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

Solution (Python):
str_line = input()
str_line2 = list(str_line)

length = len(str_line2)
line = []

for i in range(length):
    if (str_line2[i] == "1")or(str_line2[i] == "0"):
        line.append(str_line2[i])
        
        
    else:
        if len(line) != 0:
            del line[-1]
            
for i in range(len(line)):
    print(line[i],end="")

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

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

Solution (Python):
s = input()

ans = []

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

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

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

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

Solution (Python):
s = input()

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

print(''.join(res))

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

Solution (Python):
s=input()

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

Solution (Python):
S = input()
I = []
for TS in S:
    if TS=='0':
        I.append('0')
    elif TS=='1':
        I.append('1')
    elif TS=='B' and len(I)>=1:
        del I[-1]
print(''.join(I))

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

Solution (Python):
zla=list(input())
s=[]
for i in zla:
    if i=='0':
        s.append('0')
    elif i=='1':
        s.append('1')
    elif i=='B':
        if s==[]:
            pass
        else:
            s.pop()

print(''.join(s))

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:
            del ans[-1]
ans_ = ""
for s in ans:
    ans_ += s
print(ans_)

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

for i in a:
    if i=='0':
        s.append('0')
    elif i=='1':
        s.append('1')
    else:
        if len(s)==0:
            pass
        else:
            s.pop()

b="".join(s)
print(b)

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

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

Solution (Python):
s = list(map(str, input()))
t = []
for i in s:
    if i != 'B':
        t.append(i)
    else:
        if len(t) > 0:
            t.pop(-1)
print(''.join(t))