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:
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

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

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

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

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

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

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

Submission status: Accepted

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

print(*d, sep='')

Submission status: Accepted

Solution code:
s = list(input())

nows = []

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


print("".join(nows))

Submission status: Accepted

Solution code:
import copy
s=str(input())
ans=[]
for i in s:
    if i=='0':
        ans.append('0')
    elif i=='1':
        ans.append('1')
    else:
        if len(ans)>0:
            del(ans[-1])

print(''.join(ans))

Submission status: Accepted

Solution code:
from collections import deque

S=input()



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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = []
for c in input():
  if c == 'B':
    if S:
      S.pop()
  else:
    S.append(c)
print(*S, sep='')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 17:09:47 2020

@author: sd18016
"""

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

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

print("".join(ans))

Submission status: Accepted

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

print(''.join(l))

Submission status: Accepted

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

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

Submission status: Accepted

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

print(b)

Submission status: Accepted

Solution code:
import os, sys, re, math

S = input()

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

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import collections

s = list(input())

q = collections.deque()
for i in s:
    if i == "0":
        q.append("0")
    elif i == "1":
        q.append("1")
    else:
        if len(q) > 0:
            q.pop()

print("".join(q))

Submission status: Accepted

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

print(out)

Submission status: Accepted

Solution code:
S=input()
T=[]
for i in range(len(S)):
    if S[i]!="B":
        T.append(S[i])
    else:
        if T:
            del T[-1]
print(*T,sep="")

Submission status: Accepted

Solution code:
s=input()
l=[]
for i in s:
    if i=='0':
        l.append(0)
    elif i=='1':
        l.append(1)
    else:
        if l!=[]:
            l.pop()
for j in l:
    print(j,end='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
while True:
    if '0B' in S or '1B' in S:
        S = S.replace('0B','').replace('1B','')
    else:
        S = S.replace('B','')
        break
print(S)

Submission status: Accepted

Solution code:
moji = []
ans=""
s = str(input())
s = list(s)

def keyboard(key,list):
    if key == "0":
        list.append("0")
    elif key == "1":
        list.append("1")
    elif key == "B" and len(list) != 0:
        list.pop(-1)

for i in range(len(s)):
    keyboard(s[i],moji)

for x in moji:
    ans += x

print(ans)

Submission status: Accepted

Solution code:
s = input()

st =''

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

Submission status: Accepted

Solution code:
s = input()

length = len(s)

ans = ''

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

print(ans)

Submission status: Accepted

Solution code:
s = str(input())
disp = ""

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

Submission status: Accepted

Solution code:
def typing(s) : 
  t = list()
  for i in range(len(s)) :
    if s[i] == '0' :
      t.append('0')
    elif s[i] == '1' : 
      t.append('1')
    else : 
      if len(t) > 0 :
         t.pop()
     
  return t

s = input()
ans = "".join(typing(s))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

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

print(ans)

Submission status: Accepted

Solution code:
from collections import deque
s=deque(input())
ans=""
while s:
    t=s.popleft()
    if t=="0":
        ans=ans+"0"
    elif t=="1":
        ans=ans+"1"
    elif t=="B":
        if len(ans)>0:
            ans=ans[:-1]
print(ans)

Submission status: Accepted

Solution code:
s=list(input())

from collections import deque
ans=deque([])
for p in s:
  if p=="0":
    ans.append("0")
  elif p=="1":
    ans.append("1")
  elif p=="B":
    if ans:
      ans.pop()

print("".join(list(ans)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
while 'B' in S:
    S = S.replace('1B', '').replace('0B', '')

    if S[0] == 'B':
        S = S[1:]
print(S)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(''.join(d))

Submission status: Accepted

Solution code:
word_list = input()

answer = ""

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

print(answer)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc043/tasks/abc043_b

# 愚直にシミュレーションして良さそう

ans = 'x' * 20

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

Submission status: Accepted

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

for c in s:
    if c=='0':
        ans.append('0')
    if c=='1':
        ans.append('1')
    if c=='B' and len(ans)!=0:
        del 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"
  else:
    ans = ans[0:len(ans)-1]
print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
# Vicfred
# https://atcoder.jp/contests/abc043/tasks/abc043_b
# simulation
s = input()

display = []

for ch in s:
    if ch == '0' or ch == '1':
        display.append(ch)
    else:
        if len(display) > 0:
            display.pop()

for ch in display:
    print(ch,end='')
print()

Submission status: Accepted

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

S = str(input())

w = ""

for i in range(len(S)) :
  if S[i] == "B" :
    if w == "":
      w = ""
    else :
      w = w[:-1]
  else :
    w = w + S[i]
    
print(w)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
A = []
for s in S:
    if s == 'B':
        if len(A) != 0:
            del A[-1]
    else:
        A.append(s)
        
print(''.join(map(str, A)))

Submission status: Accepted

Solution code:
s=input()
l=list()
for i in str(s):
  if i == "B":
    if len(l) > 0:
      del l[-1]
    else:
      continue
  else:
    l.append(i)
a="".join(l)
print(a)

Submission status: Accepted

Solution code:
s = list(input())

while "B" in s : #Bが存在する間実行
    b = s.index('B') #最初のBのインデックスを取得
    if b != 0: # Bが先頭でないとき
        del s[b-1:b+1] # Bの1個前とBを消す
    elif b == 0: # Bが先頭の時
        del s[b]

s = ''.join(s) #この区切り文字でリストを連結
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

for x in s:
    if x != "B":
        ans.append(x)
    else:
        if ans != []:
            ans.pop()

print(*ans, sep = "")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
a=[]
b=""
for i in range(n):
  if s[i]=="B":
    if len(a)!=0:
      a.pop()
  else:
    a.append(s[i])
for i in range(len(a)):
  b+=a[i]
print(b)

Submission status: Accepted

Solution code:
S=input()

result = []
for c in list(S):
   if c == 'B' and len(result)>0:
     result.pop(-1)
   elif c== 'B':
     result = []
   else :
     result.append(c)

print("".join(result))

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[:len(ans)-1]
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'
  elif s[i] == 'B':
    ans = ans[:-1]
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:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)

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

Submission status: Accepted

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

for i in s:
  if i == 'B':
    if len(lis) != 0:
      lis.pop()
  elif i == '0':
    lis.append('0')
  elif i == '1':
    lis.append('1')
    
print(''.join(lis))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
A = []
for c in S:
	if c == 'B':
		if A:
			A.pop()
	else:
		A.append(c)
print(''.join(A))

Submission status: Accepted

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

Submission status: Accepted

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

for s in S:
    if s == "0":
        text += "0"
    elif s == "1":
        text += "1"
    elif text and s == "B":
        text = text[:-1]
print(text)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/bin/usr/env

S = input()

ans = []
for i,j in enumerate(S):
  if (len(ans) != 0) and (j == 'B'):
    ans.pop(-1)
  elif (j == 'B'):
    pass
  else:
    ans.append(j)

print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = []
for c in input():
    if c == "B":
        try:
            l.pop()
        except:
            pass
    else:
        l.append(c)
print("".join(l))

Submission status: Accepted

Solution code:
S = input()
ans = []
for s in S:
  if s=="B":
    if len(ans)==0: continue
    else: ans.pop()
  else:
    ans.append(int(s))

ans = map(str, ans)
print("".join(ans))

Submission status: Accepted

Solution code:
from collections import deque
s=input()
Q=deque()
for i in range(len(s)):
    if s[i]=="0":
        Q.append("0")
    elif s[i]=="1":
        Q.append("1")
    else:
        if len(Q)==0:
            pass
        else:
            Q.pop()
ans="".join(list(Q))
print(ans)

Submission status: Accepted

Solution code:
li = list(input())
line = []

for i in li:
  if i == "0":
    line.append("0")
  elif i == "1":
    line.append("1")
  else:
    if len(line) != 0:
      line.pop(len(line) - 1)

print("".join(line))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
    if i != "B":
        l.append(i)
    else:
        if l != []:
            del l[-1]

print("".join(l))

Submission status: Accepted

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

for i in range(len(s)):
  if(s[i] != 'B'):
    ans_list.append(s[i])
  elif(s[i] == 'B' and len(ans_list) != 0):
    ans_list.pop()
    
ans_str = ''.join(ans_list)

print(ans_str)

Submission status: Accepted

Solution code:
s = input()

new = ""
for i in s:
	if i == "0":
		new += i
	elif i == "1":
		new += i 
	elif i == "B":
		new = new[:-1]	
		
	elif i == " ":
		pass	
print("".join(new))

Submission status: Accepted

Solution code:
S = input()
stack = []
for ss in S:
    if ss == '0':
        stack.append(ss)
    elif ss == '1':
        stack.append(ss)
    elif ss == 'B':
        if len(stack):
            stack.pop()

print(''.join(stack))

Submission status: Accepted

Solution code:
S = list(input())
result = []
for s in S:
    if s != "B":
        result.append(s)
    elif len(result) == 0:
        continue
    else:
        result.pop()

print("".join(result))

Submission status: Accepted

Solution code:
def main():
    s = input()
    ans = ""
    for i in range(len(s)):
        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)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()

ans = []

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

Submission status: Accepted

Solution code:
s = input()

l = list()

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:
            l.pop()

print(''.join(l))

Submission status: Accepted

Solution code:
s = input()
s_list = []
input_list = []

for i in range(len(s)):
    s_list.append(s[i])

for i2 in range(len(s)):
    if s_list[i2] == "0":
        input_list.append("0")
    elif s_list[i2] == "1":
        input_list.append("1")
    elif input_list == []:
      pass
    else:
      input_list.pop(-1)
      

for i3 in range(len(input_list)):
    print(input_list[i3],end="")

Submission status: Accepted

Solution code:
s = input()

ans = ''
for c in s:
    if c == '0':
        ans += '0'
    if c == '1':
        ans += '1'
    if c == 'B':
        ans = ans[:-1]

print(ans)

Submission status: Accepted

Solution code:
S = list(str(input()))
ans = []
for i, s in enumerate(S):
    if s == 'B':
        if ans:
            ans.pop()
        else:
            continue
    else:
        ans.append(s)

print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()
a1=list(a)
c=""
j=0
list1=[]



for i in a1:
    if i=="0":
        list1.append("0")
        j=j+1
    elif i=="1":
        list1.append("1")
        j=j+1
    elif i!="0" and i!="1" and j>=1:
        list1.pop()
        j=j-1
for j in range(len(list1)):
    c=c+list1[j]
print(c)

Submission status: Accepted

Solution code:
N = input()

ind = ""

for i in N:
  if i == "B":
    if ind != "":
      ind = ind[0:-1]
  else:
    ind += str(i)
print(ind)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

s = input()
data = []
for x in s:
    if x == "B":
        try:data.pop()
        except:pass
    else:
        data.append(x)
print(*data,sep="")

Submission status: Accepted

Solution code:
def main():
    import sys
    
    s = sys.stdin.readline().strip()
    
    output = ""
    for i in range(len(s)):
        if s[i] == "B":
            output = output[:len(output)-1]
        else:
            output += s[i]
            
    print(output)
        
if __name__ == "__main__":
    main()