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:
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
len_s = len(s)

text = ''
for i in range(len_s):
    if s[i] == '0':
        text += '0'
    elif s[i] == '1':
        text += '1'
    else:
        if text == '':
            pass
        else:
            text = text[:-1]
print(text)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

F = []
for ch in S:
  if ch == "B": 
    if len(F) > 0:
      F.pop()
  else:
    F.append(ch)
    
print("".join(F))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
Ans = []
for s in S:
    if s == "0":
        Ans.append("0")
    elif s == "1":
        Ans.append("1")
    else:
        if Ans:
            Ans.pop()
print("".join(Ans))

Submission status: Accepted

Solution code:
s = input()
lis = []
for c in s:
    if c == 'B':
        if len(lis):
            lis = lis[:-1]
        else:
            continue
    else:
        lis.append(int(c))

for i in lis:
    print(i, end="")
print()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
    if i=='B':
        if ans != []:
            ans.pop(-1)
    else:
        ans.append(i)
print(''.join(ans))

Submission status: Accepted

Solution code:
s=list(input())
ans=list()
for i in s:
    if i=="0":
        ans.append(0)
    elif i=="1":
        ans.append(1)
    else:
        try:
            ans.pop(-1)
        except:
            pass
for i in ans:
    print(i,end="")
print()

Submission status: Accepted

Solution code:
strs = []
s = list(input())
for num in s:
    if num == "0":
        strs.append("0")
    elif num == "1":
        strs.append("1")
    elif num == "B" and strs:
        strs.pop(len(strs)-1)

print("".join(strs))

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
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 = []
for c in S:
    if c == "B":
        if ans:
            ans.pop()
    else:
        ans.append(c)
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
S = input()
L = len(S)
d = deque()
for i in range(L):
    if S[i] == "0":
        d.append("0")
    elif S[i] == "1":
        d.append("1")
    else:
        if len(d) != 0:
            d.pop()

ans = ''.join(d)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

ans = []
for t in s:
  if t == "0":
    ans.append("0")
  elif t == "1":
    ans.append("1")
  elif t == "B" and ans != []:
    ans.pop(-1)
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = ""
for i in s:
    if i == "0" or i == "1":
        ans += i
    elif i == "B" and ans == "":
        continue
    elif i == "B":
        ans = ans[:-1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#33 B - バイナリハックイージー
from collections import deque
S = input()

ans = deque([])
for s in S:
    if s == 'B' and len(ans) >= 1:
        ans.pop()
    elif s == '0' or s == '1':
        ans.append(s)
print(''.join(ans))

Submission status: Accepted

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

for s in S:
    if s == "B":
        if len(q) != 0:
            q.pop()
    else:
        q.append(s)
print("".join(q))

Submission status: Accepted

Solution code:
str = input()
ans = list()
for s in str:
    if s == 'B':
        if ans:
            ans.pop()
        continue
    else:
        ans.append(s)
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

print(s)

Submission status: Accepted

Solution code:
from collections import deque

S = input()
d = deque()

for s in S:
    if s == 'B':
        if len(d) > 0:
            d.pop()
    else:
        d.append(s)
print("".join(map(str, d)))

Submission status: Accepted

Solution code:
X = input()
text = []

for i in X:
    if i == 'B':
        text = text[:-1]
    else:
        text.append(i)
print(*text, sep='')

Submission status: Accepted

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

import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    ans = []
    for s in S:
        if s != "B":
            ans.append(s)
        else:
            if ans:
                ans.pop()
    print("".join(ans))

    return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
disp = []
for s in S:
    if s=="B":
        if not disp:
            continue
        else:
            disp.pop()
    else:
        disp.append(s)
print("".join(disp))

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
    if i == '0':
        a.append('0') 
    elif i == '1':
        a.append('1')
    elif i == 'B':
        if len(a) ==0:
            continue
        else:
            del a[-1]
        

print(''.join(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()

    while "B" in s:
        index = s.index("B")
        if index == 0:
            s = s.replace("B","",1)
        else:
            before = s[index-1]
            delete = before+"B"
            s = s.replace(delete,"",1)
    print(s)
main()

Submission status: Accepted

Solution code:
input_str = list(input())
ans = ''
for i in input_str:
    if i == '0':
        ans = ans +'0'
    elif i == '1':
        ans = ans + '1'
    elif i == 'B':
        if ans == None:
            continue
        else:
            ans = ans[:-1]
print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
x=[]
for i in s:
  if i=="0" or i=="1":
    x.append(i)
  else :
    if not x:
      pass
    else:
   	  del x[-1]
print("".join(x))

Submission status: Accepted

Solution code:
s = input()
str = ''
for char in s:
    if char == '0' or char == '1':
        str += char
    elif char == 'B':
        if str:
            str = str[:-1]
        else:
            continue

print(str)

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

Submission status: Accepted

Solution code:
str_line = input()
str_line2 = list(str_line)
#print(str_line2)
length = len(str_line2)
line = []

for i in range(length):
    if (str_line2[i] == "1")or(str_line2[i] == "0"):
        line.append(str_line2[i])
        #print(line)
        
    else:
        if len(line) != 0:
            del line[-1]
            #print(line)
for i in range(len(line)):
    print(line[i],end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = []

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

print(''.join(res))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
S = input()
I = []
for TS in S:
    if TS=='0':
        I.append('0')
    elif TS=='1':
        I.append('1')
    elif TS=='B' and len(I)>=1:
        del I[-1]
print(''.join(I))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
zla=list(input())
s=[]
for i in zla:
    if i=='0':
        s.append('0')
    elif i=='1':
        s.append('1')
    elif i=='B':
        if s==[]:
            pass
        else:
            s.pop()

print(''.join(s))

Submission status: Accepted

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

Submission status: Accepted

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

for i in a:
    if i=='0':
        s.append('0')
    elif i=='1':
        s.append('1')
    else:
        if len(s)==0:
            pass
        else:
            s.pop()

b="".join(s)
print(b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(map(str, input()))
t = []
for i in s:
    if i != 'B':
        t.append(i)
    else:
        if len(t) > 0:
            t.pop(-1)
print(''.join(t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

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

print(ans)

Submission status: Accepted

Solution code:
x = input()
li = []
sz = 0
for i in x:
    if (i == '0') or (i == '1'):
        li.append(i)
        sz += 1
    else:
        if sz > 0:
            li.pop()
            sz -= 1

for i in li:
    print(i, end="")

Submission status: Accepted

Solution code:
S = input()
stack = []
for c in S:
    if c == '0' or c == '1':
        stack.append(c)
    elif len(stack) > 0:
        stack.pop()
print("".join(stack))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

Z = []
X = len(S)

i = 0
while i  < X :
    if S[i] == "0":
        Z.append(0)
    elif S[i] == "1":
        Z.append(1)
    elif S[i] == "B":
        if len(Z)== 0:
            pass
        else:
            Z.pop()
    i += 1

i = 0
X = len(Z)
while i < X:
    print(Z[i] , end ="")
    i +=1

Submission status: Accepted

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

print("".join(ans[:ptr]))

Submission status: Accepted

Solution code:
com = list(input())
ans = []
for c in com:
    if c == '0':
        ans.append("0")
    elif c == '1':
        ans.append("1")
    elif c == 'B':
        if len(ans) == 0:
            pass
        else:
            ans.pop()
a = "".join(ans)
print(a)

Submission status: Accepted

Solution code:
s = input()
temp = []
for c in s:
    if c == "B":
        if temp:
            temp.pop()
    else:
        temp.append(c)
print("".join(temp))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

print(''.join(l))

Submission status: Accepted

Solution code:
S = input()

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

print(''.join(stack))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = str(input())
lst = []

for i in range(len(x)):
  if x[i] == 'B':  
    if len(lst) >0:
      lst.pop()
  else:
    lst.append(x[i])
print("".join(lst))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - バイナリハックイージー
def main():
    s = list(input())
    val = []

    for i in s:
        if len(val) == 0 and i == 'B':
            continue
        elif i == 'B':
            val.pop(-1)
        else:
            val.append(i)
    else:
        print(''.join(val))
 
    
if __name__ ==  "__main__":
    main()

Submission status: Accepted

Solution code:
S = str(input())
import collections

Q = collections.deque()

for i in range (0, len(S)):
	if S[i] == 'B':
		if len(Q) >= 1:
			D = Q.pop()
	else:
		Q.append(S[i])

T = str()
while Q:
	V = Q.popleft()
	T=T+V
    
print(T)

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
s1 = str(input())
s = []
for i in s1:
    if i == '0' or i == '1':
        s.append(i)
    else:
        if 1 <= len(s):
            s.pop(len(s)-1)
w = ""
for h in s:
    w += h
print(w)

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

Submission status: Accepted

Solution code:
s = input()

ans = []

back = 0

for i in range(len(s)):
  if s[-i-1] == "B":
    back += 1
  elif back:
    back -= 1
  else:
    ans.insert(0, s[-i-1])

print("".join(ans))

Submission status: Accepted

Solution code:
s = input()

while s.count("B") != 0:
    if s[0] == "B":
        s = s[1:]
    else:
        i = s.index("B")
        s = s[:i-1] + s[i+1:]
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

lis = []
for k in s:
  if k == "B":
    if len(lis) != 0:
      lis.pop()
  else:
    lis.append(k)

print("".join(lis))

Submission status: Accepted

Solution code:
s = list(input())

i = 0
while i < len(s):
    if s[i] == "B":
        if i == 0:
            del s[0]
            i -= 1
        else:
            del s[i-1:i+1]
            i -= 2

    i += 1

print("".join(s))

Submission status: Accepted

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

for i in range(S):
    if s[i]=="0":
        ans+="0"
    elif s[i]=="1":
        ans+="1"
    elif s[i]=="B":
        if len(ans)>=1:
            ans.pop()


print("".join(ans))

Submission status: Accepted

Solution code:
s=input()
stk=[]
for c in s:
    if c in '01':
        stk.append(c)
    elif stk:
        stk.pop()

print(''.join(stk))

Submission status: Accepted

Solution code:
s=input()
ans,skip='',0
for c in reversed(s):
    if c=='B':
        skip+=1
    elif skip:
        skip-=1
    else:
        ans+=c

print(ans[::-1])

Submission status: Accepted

Solution code:
S = list(input())
S_after = []
for i in S:
    if i == '1':
        S_after.append('1')
    elif i == '0':
        S_after.append('0')
    elif i == 'B':
        if S_after == []:
            pass
        else:
            S_after.pop()
print(''.join(S_after))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=str(input())
C= list(s)
list=[]
for I in range(len(C)):
    if C[I]!='B':
        list.append(C[I])
    elif C[I]=='B' and len(list)!=0:
        list.pop()
 
print("".join(list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input = input()
output = ""

for i in range(len(input)):
    if input[i] == "0":
        output += "0"
    elif input[i] == "1":
        output += "1"
    elif input[i] == "B":
        output = output[0:len(output)-1]
    else:
        pass

print(output)

Submission status: Accepted

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

for i in range(len(S)):
    if(S[i] != 'B'):
        ans.append(S[i])
    elif(S[i] == 'B' and len(ans) != 0):
        ans.pop()

        
print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]


s = input()

ans = []

for i in range(len(s)):
    if s[i] != "B":
        ans.append(s[i])
    else:
        if (len(ans) > 0):
            ans = ans[:-1]

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
S=str(input())
T=''
for i in range(len(S)):
    if S[i]=='0' or S[i]=='1':
        T+=S[i]
    else:
        T=T[:-1]
print(T)

Submission status: Accepted

Solution code:

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

for i in range(len(s)):
    if(c[i]=="0" or c[i]=="1"):
        ans_list.append(c[i])
    else:
        try:
            ans_list.pop(-1)
        except:
            a = 0

print("".join(ans_list))

Submission status: Accepted

Solution code:
import re
text = input()
b_length = len(re.sub('[^B]', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)