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.



Sample input:
01B0


Sample output:
00

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
r = ""
for x in s:
    if x == "B":
        r = r[:-1]
    else:
        r += x
print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
string = str(input())
stack = []
for i in range(len(string)):
	if string[i]!='B':
		stack.append(string[i])
	else:
		if  stack:
			stack.pop()
res = ''
for i in range(len(stack)):
	res+=stack[i]
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
character_list = list(input())
new_character_list = []

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

print(''.join(new_character_list))

Submission status: Accepted

Solution code:
def myAnswer(s:list)->str:
   ans = []
   for string in s:
      if(string == "B"):
         if(ans == []):
            continue
         else:
            ans.pop()
      else:
         ans.append(string)

   return "".join(ans)

def modelAnswer():
   return
def main():
   s = list(input())
   print(myAnswer(s))
if __name__ == '__main__':
   main()

Submission status: Accepted

Solution code:
ss=list(input())
r=''
for i, s in enumerate(ss):
  if s != 'B':
    r+=s
  elif len(r)>0:
    r=r[:-1]
print(r)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = ""
while len(s) > 1:
    t = s[0]
    s = s[1:]
    if t == "B":
        ans = ans[:-1]
    else:
        ans += t
t = s[0]
if t == "B":
    ans = ans[:-1]
else:
    ans += t
print(ans)

Submission status: Accepted

Solution code:
s = list(input())
ans = ""

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

print(ans)

Submission status: Accepted

Solution code:
s = str(input())                                                
s_list = list(s)
answer = []
 
for i in range(len(s_list)):
    if s_list[i] == '0':
        answer.append('0')
    elif s_list[i] == '1':
        answer.append('1')
    elif s_list[i] == 'B':
        if len(answer) != 0:
            answer.pop(-1)
 
new_str = ''.join(answer)
print(new_str)

Submission status: Accepted

Solution code:
s=list(input())
ans=str()

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

Submission status: Accepted

Solution code:
s = input()
a = []
for i in range(len(s)) :
	if s[i] == '0' :
		a.append(0)
		
	elif s[i] =='1' :
		a.append(1)
	elif s[i] == 'B' :
		if len(a)>0 :
			a.pop()
print(''.join(map(str,a)))

Submission status: Accepted

Solution code:
a=input()
ans=""
while len(a)>0:
  if a[0]=="0":
    ans+="0"
  elif a[0]=="1":
    ans+="1"
  elif len(ans)>0:
    ans=ans[:-1]
  a=a[1:]
print(ans)

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
S = input()

ans = []
for s in list(S):
    if s != "B":
        ans.append(s)
    elif len(ans)==0:
        pass
    else:
        ans.pop()

print(*ans,sep="")
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    s = input().rstrip()
    ans = ""
    for i in range(len(s)):
        if s[i] in ["0", "1"]:
            ans += s[i]
        else:
            ans = ans[:-1]

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ans = []
for s in S:
    if s == 'B':
        if ans:
            ans.pop(-1)
    else:
        ans.append(s)

print(*ans, sep='')

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
s = input()

A = []
for c in s:
    if c == "0":
        A.append("0")
    elif c == "1":
        A.append("1")
    elif A:
        A.pop()

print("".join(A))

Submission status: Accepted

Solution code:
s = input()
l=len(s)
a = []
for i in range(l):
    if s[i]=='B':
        a=a[:-1]
    else:
        a+=s[i]

print("".join(a))

Submission status: Accepted

Solution code:
S = input()
d = []
for s in S:
    if s == '0' or s == '1':
        d.append(s)
    else:
        d = d[:-1]

print(*d, sep='')

Submission status: Accepted

Solution code:
from collections import deque

command = list(input())
d = deque([])

for i in command:
	if i == "B" and d:
		d.pop()
	elif i == "0" or i == "1":
		d.append(i)

for s in d:
	print(s, end="")
print()

Submission status: Accepted

Solution code:
s = input()
li = list(s)
tmp = []
for l in li:
    if l == '0':
        tmp.append(l)
    elif l == '1':
        tmp.append(l)
    else:
        if len(tmp)>0:
            tmp.pop(-1)
print(''.join(tmp))

Submission status: Accepted

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

Submission status: Accepted

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

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

print("".join(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = list(input())
edita = []
for a in S:
    if a == "B":
        if not edita:
            continue
        else:
            edita.pop()
    else:
        edita.append(a)

for a in edita:
    print(a, end="")

Submission status: Accepted

Solution code:
list_S = list(input())
ans = []

for s in list_S:
    if s == "B" and len(ans) != 0:
        ans.pop(-1)
    else:
        if s != "B":
            ans.append(s)

print("".join(ans))

Submission status: Accepted

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


for i in range(0,len(s)):
  if(s[i]=="0"):
    a.append(0)
  elif(s[i]=="1"):
    a.append(1)
  elif(s[i]=="B" and len(a)==0):
    continue
  elif(s[i]=="B"):
    del a[-1]

L=[str(a) for a in a]
L="".join(L)
print(L)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
answer = []

for i in s:
        if  i == "B":
            try:
                answer.pop()
            except:
                pass
        else:
            answer.append(i)

print("".join(answer))

Submission status: Accepted

Solution code:
s = list(input())
answer = []

for i in s:
        if  i == "B":
            try:
                answer.pop()
            except IndexError:
                pass
        else:
            answer.append(i)

print("".join(answer))

Submission status: Accepted

Solution code:
s = list(input())
ans = []
for i in s:
  if i == 'B':
    try:
      ans.pop()
    except IndexError:
      pass
  else:
    ans.append(i)

print(''.join(ans))

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
s = input()
ans = ""
for x in s:
    if x == "B":
        ans = ans[:-1]
    else:
        ans += x

print(ans)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    res = []
    for i in s:
        if i=='0' or i=='1':
            res.append(i)
        else:
            res = res[:-1]
    print(*res, sep='')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S=str(input())
str_ = ""
for i in range(len(S)):
  if S[i] == "0" or S[i] == "1":
    str_ = str_ + S[i]
  elif len(str_) != 0:
    str_ = str_[:-1]
print(str_)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())
res = ""

for i in range(len(S)):
    if S[i] == "1":
        res += "1"
    elif S[i] == "0":
        res += "0"
    else:
        res = res[:-1]

print(res)

Submission status: Accepted

Solution code:
N=input()
c=""
for i  in N:
    if i=="0":
        c+="0"
    elif i=="1":
        c+="1"
    elif i=="B" and len(c)!=0:
        c=c[0:-1]  
print(c)

Submission status: Accepted

Solution code:
s = input()
slist = list(s)
res = ""
for i in slist:
    if i =="0":
        res = res +"0"
    
    elif i == "1":
        res = res+"1"
    elif i == "B":
        if len(res)==0:
            pass
        else:
            res = res[:-1]
            
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())

ans = []

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

print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
n=len(s)
k=""
t=0
for i in range(n):
    if s[i]=="B" and t!=0:
        k=k[:-1]
        t=t-1
    if s[i]=="0":
        k=k+"0"
        t=t+1
    if s[i]=="1":
        k=k+"1"
        t=t+1
print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
tmp = []
for s in S:
    if s=='B':
        if len(tmp) != 0:
            tmp.pop()
    else:
        tmp.append(s)
print(*tmp, sep='')

Submission status: Accepted

Solution code:
s = input()
from collections import deque
dq = deque()
for i in range(len(s)):
    if s[i] == "B":
        if len(dq) == 0:
            continue
        dq.pop()
        continue
    dq.append(s[i])
print("".join(dq))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-BinaryHackEasy.py
#
s = input()
ans = []

for i in range(len(s)):
    # print("tmp {}".format(s[0]))
    tmp = s[0]
    s = s[1:]
    if tmp == "B" and ans:
        ans.pop()
    elif tmp !="B":
        ans.append(tmp)
        # print(ans)

print("".join([str(n) for n in ans]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = 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]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import deque

s = ns()

st = deque()
for i in range(len(s)):
    if s[i] == 'B':
        if len(st) >= 1:
            st.pop()
    else:
        st.append(s[i])

print(*list(st), sep="")

Submission status: Accepted

Solution code:
s = input()
ans = []
for _ in s:
    if _ == 'B':
        if len(ans) != 0:
            ans.pop()
    else:
        ans.append(_)
print(*ans, sep='')

Submission status: Accepted

Solution code:
s = input()
t = []
for c in s:
    if c == '0':
        t.append('0')
    elif c == '1':
        t.append('1')
    elif t:
        t.pop()
print(''.join(t))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def scanning(s):
    def resolve(s, ans):
        if s == '':
            return ans
        elif s[0] == 'B' and len(ans) >= 0 :
            ans = ans[0:-1]
        else:
            ans += s[0]
        return resolve(s[1::], ans)
    return resolve(s, '')

print(scanning(input()))

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
from collections import deque

def main():
    s = IS()
    dq = deque()
    for c in s:
        if c == 'B':
            if dq: dq.pop()
            else: continue
        else: dq.append(c)
    print(''.join(dq))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import deque
s=input()
l=deque()
for i in range(len(s)):
  if s[i]=="B":
    if len(l)>0:
      l.pop()
  else:
    l.append(s[i])
l="".join(l)
print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = []
for i in s:
    if i == "1":
        ans += [1]
    elif i == "0":
        ans += [0]
    elif len(ans) > 0:
        ans.pop(-1)
for x in ans:
    print(x, end="")

Submission status: Accepted

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

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

result = ''.join(a)

print(result)

Submission status: Accepted

Solution code:
icase=0
if icase==0:
    s=list(input())
    p=""
    for i in range(len(s)):
        if s[i]=="0":
            p=p+"0"
        elif s[i]=="1":
            p=p+"1"
        elif s[i]=="B":
            if p!="":
                p=p[0:len(p)-1]
    print(p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(*ans,sep="")

Submission status: Accepted

Solution code:
s = input()

result = ''
for c in s:
    if c == '0' or c == '1':
        result += c
    elif c == 'B':
        result = result[:-1]
print(result)

Submission status: Accepted

Solution code:
n = str(input())

ans = ''

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 = s+x[i]
print(s)

Submission status: Accepted

Solution code:
S = input()

ans = ""
for s in S:
    if s == '0':
        ans += s
    elif s == '1':
        ans += s
    elif s == 'B' and len(ans) > 0:
        ans = ans[:-1]

print(ans)

Submission status: Accepted

Solution code:
arg=input()
ans=[]
for char in arg:
  if char=='1' or char=='0':
    ans.append(char)
  elif char=='B':
    if ans!=[]:
      del ans[-1]
print(''.join(ans))

Submission status: Accepted

Solution code:
s = input()
L = len(s)

ans = ""

for i in range(L):
    if s[i] == '1':
        ans += "1"
    elif s[i] == '0':
        ans += "0"
    else:
        if ans == "":
            pass
        else:
            ans = ans[:-1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def function(s):
  ans = ""
  for i in s:
    if i != "B":
      ans += i
    else:
      ans = ans[:len(ans) - 1]
  return ans

s = input()
print(function(s))

Submission status: Accepted

Solution code:
s = list(input())
a = []
# print(s)
 
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))

Submission status: Accepted

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

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

print(''.join(ans))

Submission status: Accepted

Solution code:
def resolve():
	s = input()
	ans = []
	for i in s:
		if i == '0' or i == '1':
			ans.append(i)
		else:
			if len(ans):
				ans.pop()
	print("".join(ans))
    
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
ans = str()
for ch in s:
    if ch == '0':
        ans += '0'
    elif ch == '1':
        ans += '1'
    elif ch == 'B':
        if len(ans) != 0:
            ans = ans[:len(ans)-1]

print(ans)

Submission status: Accepted

Solution code:
s = input()

editor = ''

for word in s:
    if word == '0':
        editor = editor + '0'
    elif word == '1':
        editor = editor + '1'
    else:
        editor = editor[:-1]
        
print(editor)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
ans='w'*60
for i in range(0,len(s)):
    if s[i]=='0':
        ans+='0'
    elif s[i]=='1':
        ans+='1'
    elif s[i]=='B':
        ans=ans[:-1]
    else:
        pass
A=s.count('0')
B=s.count('1')
C=s.count('B')

for j in range(0,60+A+B-C):
    ans=ans.lstrip('w')

print(ans)

Submission status: Accepted

Solution code:
def main():
    s = input()
    display = list()

    for i in range(len(s)):
        if s[i] == "B" :
            if len(display) > 0:
                display.pop()
        else:
            display.append(s[i])
    print("".join(map(str,display)))
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

s = input()
q = deque()
for c in s:
    if c == '0':
        q.append('0')
    elif c == '1':
        q.append('1')
    elif c == 'B':
        if len(q) == 0:
            continue
        q.pop()

print(''.join(q))

Submission status: Accepted

Solution code:
s = list(input())

hoge = []
for si in s:
  if si != "B":
    hoge.append(si)
  elif si == "B" and len(hoge) > 0:
    hoge.pop()
    
print("".join(hoge))

Submission status: Accepted

Solution code:

import collections


def solve(string):
    stack = []

    for ch in string:
        if ch == "B":
            if stack:
                stack.pop()
        else:
            stack.append(ch)

    return "".join(stack)


string = input().strip()
print(solve(string))

Submission status: Accepted

Solution code:
s = list(input())
a = []
# print(s)

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(-1)
print("".join(a))

Submission status: Accepted

Solution code:
s=input()

s=list(s)

ans = []

for i in s:
    if i == '0':
        ans.append(i)
    elif i == '1':
        ans.append(i)
    else:
        if len(ans) > 0:
            ans.pop(-1)
print(''.join(map(str,ans)))

Submission status: Accepted

Solution code:
s = []
for i in input():
  if i == "B":
    try:
      del s[-1]
    except IndexError:
      pass
  else:
    s += i
print(*s, sep="")

Submission status: Accepted

Solution code:
s = input()
ans = []
for char in s:
    if char == "0":
        ans.append("0")
    elif char == "1":
        ans.append("1")
    else:
        try:
           ans.pop()
        except:
            pass
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    ret = []
    for s in S:
        if s == "0":
            ret.append("0")
        elif s == "1":
            ret.append("1")
        elif s == "B" and len(ret) > 0:
            ret.pop()

    print("".join(ret))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = []
command = list(input())

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

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
s = str(input())

l = len(s)
ans = []

for i in range(l):
    if s[i] == str(0):
        ans.append(str(0))
    elif s[i] == str(1):
        ans.append(str(1))
    else:
        if ans == []:
          continue
        else:
          del ans[-1]
        
print(*ans, sep='')

Submission status: Accepted

Solution code:
from collections import deque
def solve():
    S = input()
    q = deque()

    for op in S:
        if op == '0':
            q.append(op)
        elif op == '1':
            q.append(op)
        else:
            if not len(q) == 0:
                q.pop()
    
    print("".join(list(q)))

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s=input()

display=[]
for i in s:
    if i=="0" or i=="1":
        display.append(i)
    elif display==[]:
        pass
    else:
        display.pop()
print("".join(display))

Submission status: Accepted

Solution code:
s = input()
# print(s)
o = []
for i in range(len(s)):
    # print(i,s[i],o)
    if (s[i] == 'B'):
        if (len(o)>0):
            o = o[:-1]
    else:
        o.append(s[i])

print(''.join(o))

Submission status: Accepted

Solution code:
s=input()

display=[]
for i in s:
    if i=="0" or i=="1":
        display.append(i)
    elif display==[]:
        pass
    else:
        display.pop()
print("".join(display))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
s=deque(input())
A=deque()
for i in range(len(s)):
  a=s.popleft()
  if a=="B":
    if len(A)>0:
      A.pop()
  else:
    A.append(a)
print("".join(A))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    s = input().rstrip()
    N = len(s)
    ans = ""

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = list(input())

# print(s)

ans = []

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

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

print(str_ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sam = input()
red = []
for i in sam:
  if i == "B":
    if red:
      del red[-1]
  else:
    red.append(i)
print(*red, sep="")

Submission status: Accepted

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