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: Wrong Answer

Solution code:
import sys
S=list(input())
print(S)
outp=""
for i in S:
    if(i=="0"):
        outp+="0"
    elif(i=="1"):
        outp+="1"
    else:
        if(len(outp)!=0):
            outp = outp[0:-1]
print(outp)

Submission status: Wrong Answer

Solution code:
lis = [i for i in input().split('B')]
print(''.join([i[:-1] if index < len(lis) -
               1 else i for index, i in enumerate(lis)]))

Submission status: Wrong Answer

Solution code:
S = input()
s = ['' for c in S]
i = 0
for c in S:
  if c == '0' or c == '1':
    s[i] = c
    i += 1
  else:
    s[i]=''
    if i > 0:
      i -= 1
print(''.join(s))

Submission status: Wrong Answer

Solution code:
S = input()
s = ['' for c in S]
i = 0
for c in S:
  if c == '0' or c == '1':
    s[i] = c
    i += 1
  else:
    if i > 0:
      s[i] = ''
      i -= 1
print(''.join(s))

Submission status: Wrong Answer

Solution code:
S = input()
ret = []
for s in S:
    if s == 'B' and len(ret):
        ret.pop()
    else:
        ret.append(s)
print(''.join(ret))

Submission status: Wrong Answer

Solution code:

# S = input()
# ret = []
# for s in S:
#     if s == 'B' and len(s):
#         ret.pop()
#     else:
#         ret.append(s)
# print(''.join(ret))

Submission status: Wrong Answer

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

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


print("".join(map(str, b)))

Submission status: Wrong Answer

Solution code:
# coding: utf-8

stack = []
for i in input():
    if i=='0':
        stack.append(0)
    elif i=='1':
        stack.append(1)
    else:
        if(len(stack)>0):
            stack.pop()

while(len(stack)>0):
    print(stack.pop(), end='')
print()

Submission status: Wrong Answer

Solution code:
s = list(input())
new_list = ""
for i in s:
    if i != 'B':
        new_list +=i
    else:
        if(len(new_list) >= 2):
            new_list = new_list[-1]
        else:
            new_list = ""

print(new_list)

Submission status: Wrong Answer

Solution code:
s = input()
new_list = ""
for i in range(len(s)):
    if s[i] != 'B':
        new_list +=s[i]
    else:
        if(len(new_list) >= 2):
            new_list = new_list[-2]
        else:
            new_list = ""

print(new_list)

Submission status: Wrong Answer

Solution code:
s = input()
new_list = ""
for i in range(len(s)):
    if s[i] != 'B':
        new_list +=s[i]
    else:
        if(len(new_list) > 2):
            new_list = new_list[-2]
        else:
            new_list = ""

print(new_list)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
s = list(input())
ans = []
for tmp in range (len(s)):
    if s[tmp] == '0':
        ans.append('0')
    elif s[tmp] == '1':
        ans.append('1')
    else:
        if len(ans) == 0:
            continue
        else:
            ans[len(ans)-1] = ''
print(''.join(ans))

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
s = input()
ans = []
for tmp in range (len(s)):
    if s[tmp] == '0':
        ans.append('0')
    elif s[tmp] == '1':
        ans.append('1')
    else:
        if len(ans) == 0:
            continue
        else:
            ans[len(ans)-1] = ''
print(''.join(ans))

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = [""] * 10
index = 0
for ss in s:
    if ss != "B":
        ans[index] = ss
        index += 1
    else:
        ans[index] = ""
        index = max(0, index - 1)

print("".join(ans))

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = [""] * 10
index = 0
for ss in s:
    if ss != "B":
        ans[index] = ss
        index += 1
    else:
        index = max(0, index - 1)
        
print("".join(ans))

Submission status: Wrong Answer

Solution code:
# coding: utf-8;

def main():
    s = input()
    ans = ''

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8;

def main():
    s = input()
    ans = ''

    for i, c in enumerate(s):
        if c == 'B' and i > 0:
            ans = ans[:i-1]
        else:
            ans += c
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s=input()
sum=""
for i in s:
    if i=="0" or i=="1":
        sum+=i
    elif len(sum) != 0:
        sum=sum.rstrip(sum[len(sum)-1])
print(sum)

Submission status: Wrong Answer

Solution code:
s = raw_input()

if 'B' not in s:
    print s
else:
    str_list = list(s)
    new_list = []
    for i, c in enumerate(str_list):
        if c != 'B':
            new_list.append(c)
        else:
            if i != 0:
                new_list = new_list[:i-1]

print ''.join(new_list)

Submission status: Wrong Answer

Solution code:
S = input()
R = list()
for x in S:
	if x == "B" and len(R) != 0:
		R.pop()
	else:
		R.append(x)
print("".join(R))

Submission status: Wrong Answer

Solution code:
S = input()
R = list()
for x in S:
	print(x)
	if x == "B" and len(R) != 0:
		R.pop()
	else:
		R.append(x)
print("".join(R))

Submission status: Wrong Answer

Solution code:
S = input()
O = ""
for i in range(len(S)):
	if i < len(S) -1 :
		if S[i] == "B" and S[i+1] == "B" and O != False:
			O = O[:-2]
		if S[i+1] != "B" and S[i] != "B":
			O += S[i]
	else :
		if S[i] != "B":
			O += S[i]
		elif O != False:
			O = O[:-2]

print(O)

Submission status: Wrong Answer

Solution code:
S = input()
O = ""
for i in range(len(S)):
	if i < len(S) -1 :
		if S[i+1] != "B" and S[i] != "B":
			O += S[i]
	else :
		if S[i] != "B":
			O += S[i]
			

print(O)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=raw_input()
a=""
for k in range(len(s)):
    if s[k]=="0":
        a=a+"0"
    elif s[k]=="1":
        a=a+"1"
    elif s[k]=="B":
        if len(a)>0:
            a=a.rstrip(a[-1])
print a

Submission status: Wrong Answer

Solution code:
print(input().replace('B', '\b'))

Submission status: Wrong Answer

Solution code:
ret = ""
s = input().strip()
s = list(str(s))
print(s)
for c in s:
    if c == "0":
        ret = ret + "0"
    elif c == "1":
        ret = ret + "1"
    else:
        if ret != "":
            ret = ret[:-1]
print(ret)

Submission status: Wrong Answer

Solution code:
import re
def f(s):
    global a
    r = p.subn('',s)
    if r[1]!=0:
        return f(r[0])[0]
    else:
        a = r[0]
        return '0'
N = raw_input()
p = re.compile('\dB')
q = re.compile('^B')
f(N)
print q.sub('',a)

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = ""
for i in s:
    if i != "B":
        ans += i
    elif len(ans) < 1:
        continue
    else:
        ans += "\b"
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = ""
for i in s:
    if i != "B":
        ans += i
    else:
        ans += "\b"
print(ans)

Submission status: Wrong Answer

Solution code:
A = []
S = input()
S=list(str(S))
for n in S:
 if n == "b":
  A.pop(-1)
 else:
  A.append(n)
print("".join(A))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import sys
     
list_n = raw_input()

output = ''

for n in list_n:
    if n == '0':
        output += '0'
    elif n == '1':
        output += '1'

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
y=raw_input()
a=[]
for i in y:
    if i=='1' or i=='0':
        a.append(i)
    else:
        if a==[]:
            continue
        else:
            del a[len(a)-1]
            print a
print ''.join(a)

Submission status: Wrong Answer

Solution code:
s = raw_input()
words = []
for c in list(s):
    if c == 'B':
        if len(words) > 1:
            words.pop()
    else:
        words.append(c)
print ''.join(words)

Submission status: Wrong Answer

Solution code:
import re

S = input()
if 'B' in S:
	A = re.split("01BB|10BB|11BB|00BB|0B|1B",S)
	A = "".join(A)
	if 'B' in A:
		C = re.split("01BB|10BB|11BB|00BB|0B|1B",A)
		C = "".join(C)
		C = C.split("B")
		print("".join(C))
	else:
		print(A)

Submission status: Wrong Answer

Solution code:
y=raw_input()
a=[]
for i in y:
    if i=='1' or i=='0':
        a.append(i)
    else:
        if a==[]:
            continue
        else:
            a.remove(a[len(a)-1])
print ''.join(a)

Submission status: Wrong Answer

Solution code:
string = input()
result = []
j=0
for i in range(len(string)):
    if string[i] == '0':
        result.append('0')
    elif string[i] == '1':
        result.append('1')
    elif string[i]=='B' and len(result)>1 and (result[-1]=='0' or result[-1]=='1'):
        result[-1]=""
str_result="".join(result)
print(str_result)

Submission status: Wrong Answer

Solution code:
string = input()
result = []
j=0
for i in range(len(string)):
    if string[i] == '0':
        result.append('0')
    elif string[i] == '1':
        result.append('1')
    elif string[i]=='B' and (result[-1]=='0' or result[-1]=='1'):
        result[-1]=""
str_result="".join(result)
print(str_result)

Submission status: Wrong Answer

Solution code:
a = list(input())
ans = []
for i in a:
    if i == "0" or i == "1":
        ans.append(i)
    
    elif len(ans) > 0 :
        ans.remove(ans[-1])

print(''.join(ans))

Submission status: Wrong Answer

Solution code:
string = input()
result = []
j=0
for i in range(len(string)):
    if string[i] == '0':
        result.append('0')
    elif string[i] == '1':
        result.append('1')
    elif string[i]=='B' and result[-1] in ['0','1']:
        result[-1]=""
str_result="".join(result)

print(str_result.replace(" ",""))

Submission status: Wrong Answer

Solution code:
a = list(input())
ans = []
for i in a:
    if i == "0" or i == "1":
        ans.append(i)
    
    else :
        ans.remove(ans[-1])

print(''.join(ans))

Submission status: Wrong Answer

Solution code:
string = input()
result = []
j=0
for i in range(len(string)):
    if string[i] == '0':
        result.append('0')
    elif string[i] == '1':
        result.append('1')
    elif string[i]=='B' and result[-1] in ['0','1']:
        result[-1]=""
str_result=" ".join(result)
print(str_result.replace(" ",""))

Submission status: Wrong Answer

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

for char in s:
    if char == "0":
        array.insert(0,"0")
    elif char == "1":
        array.append("1")
    else:
        if len(array) != 0:
            del array[-1]
        else:
            pass

print("".join(array))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
y=raw_input()
i=0
a=[]
if len(y)==1:
    if y=='1':
        print '1'
    else:
        print '0'
else:
    for j in range(len(y)-1):
        if y[j+1]=='B' or y[j]=='B':
            continue
        else:
            if y[j]=='1':
                a.append('1')
            else:
                a.append('0')
    if y[len(y)-1]!='B':
        a.append(y[len(y)-1])
    print ''.join(a)

Submission status: Wrong Answer

Solution code:
from re import search, sub

def update(s):
    if (search(r'.B', s)):
        return update(sub(r'.B', '', s))
    else:
        return s.replace('B', '')


print(update(input()))

Submission status: Wrong Answer

Solution code:
from re import search, sub

def update(s):
    if (search(r'B', s)):
        return update(sub(r'.B', '', s))
    else:
        return s


print(update(input()))

Submission status: Wrong Answer

Solution code:
from re import sub


s = input()

print(sub(r'.B', '', s).replace('B', ''))

Submission status: Time Limit Exceeded

Solution code:
s = input()
while "B" in s:
    s = s.replace("1B", "").replace("0B", "")
print(s.replace("B", ""))

Submission status: Time Limit Exceeded

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

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

Submission status: Accepted

Solution code:
S = str(input())

stack = []

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

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

Submission status: Accepted

Solution code:
S=list(input())

ans=[]

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

Submission status: Accepted

Solution code:
first_str =input()

input_list = list(first_str)

total_list = list()

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

    print(ans_str)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
ans = []
for i in range(len(s)) :
    if s[i] == "0" :
        ans.append("0")
    elif s[i] == "1" :
        ans.append("1")
    elif s[i] == "B" and len(ans) > 0 :
        del ans[-1]
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

    return result

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import math
from datetime import date

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

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

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

	print(line)
	
main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(res)

Submission status: Accepted

Solution code:
# Sの入力受付
S = input()
# Sを順に読み込みBがあったとき直前の文字と一緒に消去
STR = ""
for i in S:
    STR = STR + i
    if i == "B" and STR == "":
        STR = ""
    elif i == "B":
        STR = STR[:len(STR) - 2]
print(STR)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

S = input()

ans = deque([])

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

stack = []

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

from collections import deque

q = deque()

s = input()
for operation in s:
    if operation == "0":
        # 右端に0を追加
        q.append("0")

    elif operation == "1":
        # 右端に1を追加
        q.append("1")

    elif operation == "B":
        # バックスペース
        # 右端を一つ削除
        # q の中身が空でもエラーにならないように例外処理
        try:
            q.pop()
        except IndexError:
            pass # 何もしない

# キューの中身を順番に取り出して文字列に変換
answer = ""
for i in q:
    answer = answer + i

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    print(solve(s))

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

if __name__ == '__main__':
    #test()
    main()

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

Submission status: Accepted

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

print("".join(stack))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=str(input())

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

Submission status: Accepted

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

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

print(ret)

Submission status: Accepted

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

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

print(''.join(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(z)

Submission status: Accepted

Solution code:
from collections import deque


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = str(input())

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

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

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

stack = []

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

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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