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

Submission status: Accepted

Solution code:
S = input()
T = ""
for s in S:
  if s == "0":
    T += "0"
  elif s == "1":
    T += "1"
  elif len(T)>0:
    T = T[:-1]
print(T)

Submission status: Accepted

Solution code:
def bs(s):
  if s == "":
    return s
  else:
    return s[:-1]
 
s = input()
ans = ""
for c in s:
  if c == "B":
    ans = bs(ans)
  else:
    ans += c
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    s = input()
    a = []
    for e in s:
        if e == 'B':
            if a: a.pop()
        else:
            a.append(e)
    print(''.join(a))
        


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""

Submission status: Accepted

Solution code:
NN = input()
list1 =[]
for i in NN:
  if i == '0':
    list1.append('0')
  elif i == '1' :
    list1.append('1')
  else:
    if len(list1) == 0:
      pass
    else:
      list1.pop(-1)
for i in list1:
  print(i,end ='')

Submission status: Accepted

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

for i in s:
    if i == "B":
        if not ans == "":
            ans = ans[:-1]
    else:
        ans = ans + i

print(ans)

Submission status: Accepted

Solution code:
s = list(input())
output = []
for i in range(len(s)):
    if s[i] == "0":
        output.append("0")
    elif s[i] == "1":
        output.append("1")
    else:
        if len(output) > 0:
            output.pop()
        else:
            pass
print("".join(output))

Submission status: Accepted

Solution code:
s = list(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:
S = list(input())
ans_list = []
for i in S:
  if i == "0":
    ans_list.append("0")
  elif i == "1":
    ans_list.append("1")
  else:
    if len(ans_list) != 0:
      del ans_list[-1]
ans = "".join(ans_list)    
print(ans)

Submission status: Accepted

Solution code:
s = input()

i = list(s)

answer = []

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

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

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

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

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

    
print(ans)

Submission status: Accepted

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

resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(input())

ans = [] #答え用意

for s in S:
  if s != 'B':
    ans.append(s) #末尾に要素追加
  elif len(ans) != 0: #長さ
    del ans[-1] #指定した位置(今回は末尾:-1)の要素を削除
    
print("".join(ans))

Submission status: Accepted

Solution code:
S = input()

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

print("".join(res))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
import itertools
import math

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

d = deque()

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

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

Submission status: Accepted

Solution code:
def main():
    from collections import deque
    s = list(input())
    ans = deque([])
    for i in s:
        if i == '0':
            ans.append('0')
        elif i == '1':
            ans.append('1')
        else:
            if len(ans)!= 0:
                ans.pop()

    print(''.join(ans))

main()

Submission status: Accepted

Solution code:
import collections

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

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

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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:
#!/usr/bin/env python
# coding: utf-8

# In[5]:


s = input()


# In[6]:


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


# In[ ]:

Submission status: Accepted

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

print(''.join(ans))

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
S = input()

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

print(ret)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(''.join(t))

Submission status: Accepted

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

key()

Submission status: Accepted

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

Submission status: Accepted

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

hi()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

print(answer)

Submission status: Accepted

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

print(r)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(''.join(ans))

Submission status: Accepted

Solution code:
s = input()

list = []

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

print("".join(list))

Submission status: Accepted

Solution code:
#入力
input = input()

text = ''

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

#出力
print(text)

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

Submission status: Accepted

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

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

print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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


print(*c, sep='')

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
from fractions import gcd
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) # tupleも検討する。
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


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

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

    print("".join(ans))

if __name__ == '__main__':
    main()

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[0:-1]

print(ans)

Submission status: Accepted

Solution code:
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
# ... 最小側の制約も確認した？
# ... オーバーフローしない？
s = input()
ans = ""
for x in s:
    if x=='B':
        if ans!="": ans = ans[:-1]
    else: ans+=x
print(ans)

Submission status: Accepted

Solution code:
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
# ... 最小側の制約も確認した？
# ... オーバーフローしない？
s = input()
ans = ""
for x in s:
    if x=='0': ans+='0'
    elif x == '1': ans+='1'
    else:
        if len(ans) == 0: pass
        else: ans = ans[:-1]
    #print(ans)
print(ans)

Submission status: Accepted

Solution code:
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
# ... 最小側の制約も確認した？
# ... オーバーフローしない？
s = input()
ans = []
for x in s:
    if x=='0': ans.append('0')
    elif x == '1': ans.append('1')
    else:
        if len(ans) == 0: pass
        else: ans.pop()
for t in ans: print(t, end = "")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(len(s)):
    #print("s[{}] = {}".format(i, s[i]))
    if s[i] == "B":
        if out:
            out = out[:-1]
            
    elif s[i] == "0":
        out = out + "0"

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

print(out)

Submission status: Accepted

Solution code:
#ABC043Bprint(1,end='')
s=input()
s_=[]
for i in range(len(s)):
    if s[i]=="1":
        s_.append("1")
    if s[i]=="0":
        s_.append("0")
    if s[i]=="B":
        if len(s_)!=0:
            s_.pop()

print(''.join(s_))

Submission status: Accepted

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

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

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

            

display()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = ""

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

print(a)

Submission status: Accepted

Solution code:
a = ""

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

print(a)

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

Solution code:
from collections import deque

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

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

print("".join(l))

Submission status: Accepted

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

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

print(''.join(txt))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(''.join(ans))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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


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


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

Submission status: Accepted

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

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
order = input()

order = list(order)

text = []

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

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

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

print("".join(text))

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

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = list(input())

ans = []

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

  else:
    pass

print(''.join(ans))

Submission status: Accepted

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

print(''.join(ans))

Submission status: Accepted

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

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

print(''.join(res))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC043-B
s = input()

result = []

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


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

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

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

Submission status: Accepted

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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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