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


def solve(s: str):
    z = ""
    for c in s:
        if c == "B":
            z = z[:-1]
        else:
            z += c
    print(z)


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

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

print(*ans, sep='')

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

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

Solution (Python):
li = list(input())
ans = ''

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

print(ans)

Solution (Python):
li = list(input())
ans = ''

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

print(ans)

Solution (Python):
given = [x for x in input()]
rets  = []
for i, v in  enumerate(given):
    if v in ["1", "0"]:
        rets += v
    elif v == "B" and len(rets) > 0:
        rets.pop()

print("".join(rets))

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

Solution (Python):
a=input()
f=[]
for i in a:
    if i == "0":
        f.append("0")
    elif i == "1":
        f.append("1")
    elif i == "B" and len(f) != 0:
        f.pop(len(f)-1)
print("".join(f))

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

Solution (Python):
s=input()
for k in range(len(s)//2):
    s=s.replace("1B","").replace("0B","")
    if s==s.replace("1B","").replace("0B",""):
        break
s=s.replace("B","")
print(s)

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

Solution (Python):
s = input()
s=s[::-1]

b_cnt=0
ans=[]
for c in s:
    if c=="B":
        b_cnt+=1
    elif b_cnt==0:
        ans.append(c)
    else:
        b_cnt-=1
        if b_cnt <0:
            b_cnt=0
ans.reverse()

for c in ans:
    print(c,end="")

Solution (Python):


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

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

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

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

Solution (Python):


s = input()
ans = []

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

print(''.join(ans))

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

for s in S:
    if s != "B":
        l.append(s)
    if s == "B" and len(l) != 0:
        l.pop()
    if s == "B" and len(l) == 0:
        continue
print("".join(l))

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

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

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

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

for i in range(len(s)):
    if s[i]=="0":
        buf="".join((buf,"0"))
    elif s[i]=="1":
        buf = "".join((buf, "1"))
    elif s[i]=="B":
        if len(buf)>0:
            buf=buf[:len(buf)-1]
    
print(buf)

Solution (Python):
a=input()
A=[]
for i in a:
  if i=='B'and len(A)>0:
    del A[-1]
  elif i=='1'or i=='0':
    A.append(i)
print(*A,sep='')

Solution (Python):
*s, = input()

ans = []
for _s in s:
    if _s == "0":
        ans.append("0")
    elif _s == "1":
        ans.append("1")
    elif _s == "B" and 0 < len(ans):
        ans.pop()

print("".join(ans))

Solution (Python):
S = input()

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

print("".join(a for a in ans))

Solution (Python):
s = input()
t=[]
for c in s:
    if c!='B':
        t.append(c)
    elif len(t)!=0 :
        t.pop()

for c in t:
    print(c,end='')

Solution (Python):
s = input()
t=[]
for c in s:
    if c!='B':
        t.append(c)
    elif len(t)!=0 :
        t.pop()

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

Solution (Python):

s = input()
lst = []
for i in s:
    if i == 'B' and len(lst) !=0:
        lst.pop()
    elif i == 'B':
        continue
    else:
        lst.append(i)
print(''.join(lst))

Solution (Python):
s = input()

ans = []

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

print("".join(ans))

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

Solution (Python):
def resolve():
    s = input()
    ans = []
    for char in s:
        if char == 'B':
            if len(ans) == 0:
                continue
            else:
                ans = ans[:-1]
        else:
            ans.append(char)

    print(''.join(ans))

resolve()

Solution (Python):
sl = list(input())
ans = []
for s in sl:
    if s != 'B':
        ans.append(s)
    else:
        if len(ans) != 0:
            ans.pop(-1)

print(*ans, sep='')

Solution (Python):
a = input()

A = []

for i in a:
    if i != "B":
        A.append(i)
    else:
        if A == []:
            continue
        else:
            A = A[:-1]
print("".join(A))

Solution (Python):
s = input()

ans = ""
for word in s:
    if word == "0":
        ans += "0"
    elif word == "1":
        ans += "1"
    else:
        if ans != "":
            ans = ans[:-1]

print(ans)

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

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

Solution (Python):
Inp = input()
Ext = ''
for val in range(len(Inp)):
    if Inp[val] == '0':
        Ext += '0'
    elif Inp[val] == '1':
        Ext += '1'
    else:
        Ext = Ext[:-1]
print(Ext)

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

print("".join(ans))

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

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

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

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

print(n)

Solution (Python):

s = input()
ans = []

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

name = "".join(ans)

print(name)

Solution (Python):
S = list(input())
l=[]
for i in S:
    if i == "B":
        if len(l)==0:
            continue
        else:
            l.pop()
    else:
        l.append(i)
print(*l, sep="")

Solution (Python):
s=str(input())
while(s.count("B")!=0):
  i=s.find("B")
  if i!=0:
    s=s[:i-1]+s[i+1:]
  else:
    s=s[1:]
print(s)

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

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

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

for x in s:
    if x=="0":r.append("0")
    elif x=="1":r.append("1")
    elif x=="B" and len(r)>0:
        r.pop()
print("".join(r))

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

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

Solution (Python):




def main():
    S = list(input())
    reslut = []
    for s in S:
        if s == 'B' and len(reslut) == 0:
            continue
        elif s == 'B':
            reslut.pop()
        else:
            reslut.append(s)
    print(''.join(reslut))


if __name__ == "__main__":
    main()

Solution (Python):
k = str(input())
n = list(k)
l = []
s = ""
for i in n:
    if(i == '0'):l.append(i)
    if(i == '1'):l.append(i)
    if(i == 'B'):
        if(len(l)==0):
            continue
        else:
            l.pop()
print(s.join(l))

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

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

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

print("".join(ans))

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

answer = []

for i in a:
  
  if i == "1" or i == "0":
    answer.append(i)
  else:
    if not answer :
      continue
    else:
      del answer[-1]

print("".join(answer))

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

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

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

Solution (Python):
stack = []
for s in input():
    if s == '0' or s == '1':
        stack.append(s)
    elif s == 'B' and len(stack) != 0:
        stack.pop()
print(''.join(stack))

Solution (Python):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = readline().decode('utf8').rstrip()

lis = []

for m in S:
    if m != 'B':
        lis.append(m)
    else:
        if len(lis):
            lis.pop()

print(*lis, sep='')

Solution (Python):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = readline().decode('utf8').rstrip()

lis = []

for m in S:
    if m != 'B':
        lis.append(m)
    else:
        if len(lis):
            lis.pop()

print(*lis, sep='')

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

Solution (Python):
s = list(input())
o = []
for i in s:
    if i == "B":
        if len(o) == 0:
            pass
        else:
            o.pop(-1)

    else:
        o += [i]

print("".join(o))

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

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

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

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

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

Solution (Python):
def main():
    data = input()

    result = ""
    for chr in data:
        if chr == "0":
            result += "0"
        elif chr == "1":
            result += "1"
        elif chr == "B":
            result = result[:-1]

    print(result)

if __name__ == "__main__":
    main()

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

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):
s = input()
l = []
le = len(s)
for i in s:
    if i=='B':
        if len(l)>0: l.pop()
    else: l.append(i)
print(''.join(l))

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' and len(l)!=0:
        l.pop()
    
for i in l:
    print(i,end='')

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

Solution (Python):
s=""
l=[]
string = input()
key=[]
for j in string:
    key.append(j)

for i in key:
    if i=='0':
        l.append(i)
    elif i=='1':
        l.append(i)
    elif i=='B':
        if len(l)==0:
            pass
        else:
            l.pop()

for i in l:
    s=s+i
print(s)

Solution (Python):
string = input()
l = 0
string1 = []
 
for i in string:
    if(i == '1'):
        string1.append('1')
        l += 1
    elif(i == '0'):
        string1.append('0')
        l += 1
    elif(i == 'B'):
        if(l > 0):
            string1.pop()
            l = l - 1
 
for i in string1:
    print(i, end = '')

Solution (Python):
s = input()
len = 0
op = []

for i in s:
    if(i == '1'):
        op.append('1')
        len += 1
    elif(i == '0'):
        op.append('0')
        len += 1
    elif(i == 'B'):
        if(len > 0):
            op.pop()
            len = len - 1

for i in op:
    print(i, end = '')

Solution (Python):
s = input()

s = list(s)
k = []
a = ''
for i in s:
    if k != [] and i == 'B':
        k.pop()
    elif i != 'B':
        k.append(i)
    
print(a.join(k))

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

Solution (Python):
s = input()

output = []

for i in s:
    if i != "B":
        output.append(i)
    elif output != []:
        output.pop()

print(''.join(output))

Solution (Python):
s = input()

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

Solution (Python):
S=list(input())
T =[]
for i in range(len(S)):
  if S[i]=='B':
    T=T[:-1]
  else:
    T.append(S[i])
print(''.join(T))

Solution (Python):
def solve(s):
    l = []
    for c in s:
        if c != 'B':
            l.append(c)
        elif l:
            l.pop()
    return ''.join(l)

_s = input()
print(solve(_s))

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):
s = str(input())
s_list = []
for i in s:
	if i != 'B':
		s_list.append(i)
	else:
		if len(s_list) != 0:
			s_list.pop()
print(''.join(s_list))

Solution (Python):

s=input()
def solution(s):
    new = []
    for c in s:
        if c == '0':
            new.append('0')
        elif c == '1':
            new.append('1')
        elif c == 'B':
            try:
                new.pop()
            except:
                pass
    newnew = ''.join(new)
    return newnew
print(solution(s))

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

print(result)

Solution (Python):
inputs = list(map(str, input()))
 
output = ''
for i in inputs:
    if i == 'B':
        output = output[:-1]
    elif i == '1':
        output += '1'
    else:
          output += '0'
print(output)

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

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

print(''.join(ans))

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

r = ''

for c in s:
  if c == 'B':
    r = r[:-1]
  elif c == '0' or c == '1':
    r += c

print(r)

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

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

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

Solution (Python):
S=list(input())
stack=[]
for s in S:
    if s!="B":
        stack.append(s)
    elif len(stack)!=0:
        stack.pop()


print("".join(stack))

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

Solution (Python):
S = list(str(input()))
X=[]
for i in S:
    if i == "0" or i == "1":
        X.append(i)
    elif i == "B":
        if len(X)>0:
            X.pop(len(X)-1)
print("".join(X))

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

Solution (Python):
import sys


key = input()

display = ""
for i in key:
    if i == '0':
        
        display += '0'
    if i == '1':
        
        display += '1'
    if i == 'B':
        
        display = display[:-1]

print(display)

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

for i in range(len(S)):
    if S[i] == "0" or S[i] == "1":
        List.append(S[i])
    else:
        if len(List) != 0:
            List.pop()
for j in range(len(List)):
    print(List[j], end='')

Solution (Python):
def keyboard_function(input_keyboard, editor_display):

    if input_keyboard=='B':
        if editor_display==[]:
            return editor_display
        else:
            editor_display.pop()
    if input_keyboard=='0':
        editor_display.append('0')
    if input_keyboard=='1':
        editor_display.append('1')
        
    return editor_display

def show_editor_display(input_keyboard_sequence):
    editor_display=[]
    for i in input_keyboard_sequence:
        keyboard_function(i, editor_display)        
    return ''.join(editor_display)

if __name__=='__main__':
    input_keyboard_sequence=input()
    print(show_editor_display(input_keyboard_sequence))

Solution (Python):
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
YN=['Yes','No']
inf=float('inf')
input=lambda: sys.stdin.readline().rstrip()

ans=0

q=[]
for i in input():
    if i=='B':
        if q:
            q.pop()
    else:
        q+=[i]

print(''.join(q))

Solution (Python):
s = input()

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

print(result)

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

for i in range(len(s)):
    if (s[i] == "B"):
        if(len(a) <= 0):
            continue
        else:
            a.pop()
    else:
        a.append(s[i])
print(''.join(a))

Solution (Python):
if __name__ == '__main__':
	S = input()
	S = [s.split()[0] for s in S]
	ans = []
	for i in range(0,len(S)):
		if S[i] == 'B' and len(ans)>0:
			ans.pop()
		elif S[i] != 'B':
			ans.append(S[i])

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

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

Solution (Python):
inputs = input()
answer = ''

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

Solution (Python):
if __name__ == "__main__":
    input_str = input()
    ans = []
    for s in input_str:
        if s == "0":
            ans.append("0")
        elif s == "1":
            ans.append("1")
        else:
            if len(ans) == 0:
                continue
            else:
                ans.pop()

    print("".join(ans))

Solution (Python):

s = input()

f = ''

for i in s:
    if i == '0' or i == '1':
        f += i
    elif i == 'B':
        f = f[:-1]
    else:
        continue

print(f)

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

Solution (Python):
import sys
import queue
bbn=1000000007
	


		
def main():
	s = input()
	ll=[]
	for c in s:
		if c == 'B':
			if len(ll) != 0:
				ll.pop(-1)
				
		else:
			ll.append(c)
			
	ret=''.join(ll)
	print(ret)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

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

stack = []
for i in range(len(arr)):
    if arr[i] == '0' or arr[i] == '1':
        stack.append(arr[i])
    elif arr[i] == 'B' and len(stack) != 0:
        stack.pop(-1)

print(''.join(stack))

Solution (Python):
chars = input()

ans = []
for c in chars:
    if c in ['0', '1']:
        ans.append(c)
    elif len(ans) != 0:
        ans.pop(-1)

print(''.join(ans))

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

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

print(ret)

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

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    ss=STR()
    ans=[]
    for s in ss:
        if s=='0'or s=='1':
            ans.append(s)
        elif s=='B':
            if len(ans)>0:
                d=ans.pop(-1)
                
            else:
                pass
    print(*ans,sep='')
            
if __name__ == '__main__':
    do()

Solution (Python):
S = list(input())
t = []
N = len(S)

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

print(*t, sep = "")

Solution (Python):
s = input()

while(s.count('B')):
    if s.count('0B'):
        s = s.replace('0B','')
    elif s.count('1B'):
        s = s.replace('1B','')
    else:
        s = s.replace('B','')   
        
print(s)

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

Solution (Python):

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

for pushed_key in s:
    if pushed_key == "0":
        ans.append("0")
    elif pushed_key == "1":
        ans.append("1")
    elif pushed_key == "B":
        if len(ans) != 0:
            ans.pop(-1)
            
print(''.join(ans))

Solution (Python):



class KeySeq:

    def __init__(self):
        self.seq = []

    def _add_char(self, ch):
        if ch in ['0', '1']:
            self.seq.append(ch)

    def _backspace(self):
        self.seq = self.seq[:len(self.seq)-1]

    def apply(self, ch):
        if ch == 'B':
            self._backspace()
        else:
            self._add_char(ch)

    def __str__(self):
        return ''.join(self.seq)

keyseq = KeySeq()
s = input()
for ch in list(s):
    keyseq.apply(ch)

print(keyseq)

Solution (Python):



class KeySeq:

    def __init__(self):
        self.seq = []

    def _add_char(self, ch):
        if ch in ['0', '1']:
            self.seq.append(ch)

    def _backspace(self):
        self.seq = self.seq[:len(self.seq)-1]

    def apply(self, ch):
        if ch == 'B':
            self._backspace()
        else:
            self._add_char(ch)

    def __str__(self):
        return ''.join(self.seq)

keyseq = KeySeq()
s = input()
for ch in list(s):
    keyseq.apply(ch)

print(keyseq)

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

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

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

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

print(''.join(res))

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 i in range(len(s)):
    a=s[i]
    if a=='0':
        ans+='0'
    elif a=='1':
        ans+='1'
    else:
        if len(ans)!=0:
            ans=ans[:-1]

print(ans)