ZhenlongDai/ACPR huggingface dataset:
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
a=[]
def b(x):
  if len(x)!=0:
    x=x[:len(x)-1]
  return x
for i in range(len(s)):
  if s[i]=='B':
    a=b(a)
  else:
    a.append(s[i])
print(a)

Failing test case input:
B001

Expected output:
001


Actual output:
0, 0, 1

Fixed submission (verdict: Accepted):
s=input()
a=[]
def b(x):
  if len(x)!=0:
    x=x[:len(x)-1]
  return x
for i in range(len(s)):
  if s[i]=='B':
    a=b(a)
  else:
    a.append(s[i])
for _ in range(len(a)):
  print(a[_],end='')

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n =input()
ans=""

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

print(ans)


Failing test case input:
0@B1

Expected output:
01


Actual output:
0@B1


Fixed submission (verdict: Accepted):
n =input()
ans=""

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

print(ans)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
string=input()
ans=""
for x in string:
    if x!="b":
        ans+=x
    else:
        ans=ans[:-1]
print(ans)

Failing test case input:
0/B1

Expected output:
01


Actual output:
0/B1


Fixed submission (verdict: Accepted):
string=input()
ans=""
for x in string:
    if x!="B":
        ans+=x
    else:
        ans=ans[:-1]
print(ans)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
res =[]
for i in range(len(s)):
	print(res)
	if s[i] == 'B':
		if len(res) != 0:
			res.pop(len(res)-1)
		continue
	res.append(s[i])

print("".join(res))

Failing test case input:
B1B0

Expected output:
0


Actual output:
[]
[]
['1']
[]
0


Fixed submission (verdict: Accepted):
s = input()
res =[]
for i in range(len(s)):
	if s[i] == 'B':
		if len(res) != 0:
			res.pop(len(res)-1)
		continue
	res.append(s[i])

print("".join(res))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
from collections import deque
input = stdin.readline

s = input().rstrip()
d = deque([])

for i in s:
    if s != "B":
        d.append(s)
    else:
        if d:
            d.pop()
        else:
            pass

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

print()


Failing test case input:
B00.

Expected output:
00.


Actual output:
B00.B00.B00.B00.


Fixed submission (verdict: Accepted):
from sys import stdin
from collections import deque
input = stdin.readline

s = input().rstrip()
d = deque([])

for i in s:
    if i != "B":
        d.append(i)
    else:
        if d:
            d.pop()
        else:
            pass

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

print()
Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
ans = []
for i in range(len(s)):
    if s[i] == 'B' and ans:
        ans.pop()
    else:
        ans.append(s[i])
print(ans)

Failing test case input:
011B

Expected output:
01


Actual output:
0, 1

Fixed submission (verdict: Accepted):
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))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
S = ""
for i in range(len(s)):
    if s[i] == "B":
        if S == "":
            continue
        else:
            S = S.rstrip(S[-1])
    else:
        S += s[i]
print(S)

Failing test case input:
B11B

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
s = list(input())
S = ""
for i in range(len(s)):
    if s[i] == "B":
        if S == "":
            continue
        else:
            S = S[:-1]
    else:
        S += s[i]
print(S)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

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

print(result)

Failing test case input:
0/B1

Expected output:
01


Actual output:
0
01


Fixed submission (verdict: Accepted):
s = input()

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

print(result)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans = []
for c in s:
    if (c == 'B'):
        if (len(ans) > 0):
            ans.pop(-1)
    else:
        ans.append(c)

print(str(ans))


Failing test case input:
00B0

Expected output:
00


Actual output:
0, 0

Fixed submission (verdict: Accepted):
s = input()
ans = []
for c in s:
    if (c == 'B'):
        if (len(ans) > 0):
            ans.pop(-1)
    else:
        ans.append(c)

print(''.join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s-1):
    if s[i+1] == "B":
        output.append("D")
    else:
        output.append(s[i])
output.append(s[len_s-1])
output2 = [j for j in output if j.isdigit()]
print("".join(output2))

Failing test case input:
B00.

Expected output:
00.


Actual output:
00


Fixed submission (verdict: Accepted):
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
    if s[i] == "B":
        try:
            output.pop(-1)
        except:
            pass
    else:
        output.append(s[i])
print("".join(output))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
t = ''
for x in s:
  if x == 'B' and len(t) > 0:
    t = t[:-1]
  else:
    t = t + x

Failing test case input:
02B0

Expected output:
00


Actual output:

Fixed submission (verdict: Accepted):
s = input()
t = ''
for x in s:
  if x == 'B':
    t = t[:-1]
  else:
    t = t + x
print(t)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())


a = []


for i in s:
 
  if i == 'B' and s.index(i) == 0:
    pass
  elif i == 'B':
    a = a[:-1]
    
  else:
    a.append(i)
  
    
print(''.join(a))    
    

Failing test case input:
B/B0

Expected output:
0


Actual output:
/0


Fixed submission (verdict: Accepted):
s = list(input())


a = []


for i in s:
 
  if i == 'B' and s.index(i) == 0:
    a = a[:-1]
  elif i == 'B':
    a = a[:-1]
    
  else:
    a.append(i)
  
    
print(''.join(a))

Problem: p04030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = list(str(input()))
ans = []
for i in s:
  if i == "B":
    if ans == []:
      continue
    else:
      ans.remove(ans[-1])
  else:
    ans.append(i)
print("".join(ans))

Failing test case input:
010B

Expected output:
01


Actual output:
10


Fixed submission (verdict: Accepted):
from collections import deque
s = list(str(input()))
ans = deque()
for i in s:
  if i == "B":
    if ans == deque([]):
      continue
    else:
      ans.pop()
  else:
    ans.append(i)
print("".join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
arr =list(input())
ret=""
for st in arr:
  if(st == "B"):
    ret = ret[:len(st)-1]
  else:
    ret = ret + st
      
print(ret)
  

Failing test case input:
0AB1

Expected output:
01


Actual output:
1


Fixed submission (verdict: Accepted):
arr =list(input())
ret=""
for st in arr:
  if(st == "B"):
    ret = ret[:len(ret)-1]
  else:
    ret = ret + st
      
print(ret)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
S = []
for i in range(len(s)):
    S.append(s[i])
j = 0

while True:
    if S[j] == "B" and j != 0:
        del S[j - 1]
        del S[j - 1]
        j = 0
    elif S[j] == "B" and j == 0:
        del S[j]
    else:
        j = j + 1
        if j == len(S) - 1 or len(S) == 1:
            break

print("".join(S))

Failing test case input:
B01B

Expected output:
0


Actual output:
01B


Fixed submission (verdict: Accepted):
s = input()
S = []
for i in range(len(s)):
    S.append(s[i])
j = 0

while True:
    if S[j] == "B" and j != 0:
        del S[j - 1]
        del S[j - 1]
        j = 0
    elif S[j] == "B" and j == 0:
        del S[j]
    else:
        if j == len(S) - 1 or len(S) == 1:
            break
        j = j + 1

print("".join(S))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

res = ''

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

Failing test case input:
B10B

Expected output:
1


Actual output:
10


Fixed submission (verdict: Accepted):
s = input()

res = ''

for i in range(len(s)):
    if res == '':
        if s[i] == 'B':
            pass
        else:
            res += s[i]
    else:
        if s[i] == 'B':
            res = res[:-1]
        else:
            res += s[i]
    
print(res)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
t = ''
for x in s:
  if x == 'B' and len(t) > 0:
    t = t[:-1]
  else:
    t = t + x
print(t)

Failing test case input:
B/B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
s = input()
t = ''
for x in s:
  if x == 'B':
    t = t[:-1]
  else:
    t = t + x
print(t)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

Failing test case input:
B3B1

Expected output:
1


Actual output:
1

Fixed submission (verdict: Accepted):

s = input()
lst = []
for i in s:
    if i == 'B' and len(lst) !=0:
        lst.pop()
    elif i == 'B':
        continue
    else:
        lst.append(i)
print(''.join(lst))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
ss=input().split()
r=''
for s in ss:
  if s!='B':
    r+=s
  elif len(r)>0:
    r=r[:-1]
print(r)


Failing test case input:
-B11

Expected output:
11


Actual output:
-B11


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

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = []

for i in range(len(s)):
    if (s[i] == "B"):
        if(len(a) == 0):
            continue
        else:
            a.remove(a[len(a)-1])
    else:
        a.append(s[i])
print(''.join(a))

Failing test case input:
101B

Expected output:
10


Actual output:
01


Fixed submission (verdict: Accepted):
s = input()
a = []

for i in range(len(s)):
    if (s[i] == "B"):
        if(len(a) <= 0):
            continue
        else:
            a.pop()
    else:
        a.append(s[i])
print(''.join(a))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans = ""
for k in s:
  if k == 'B':
    if len(s) > 0:
      ans = ans[:len(s)-1]
  else:
    ans += k
print(ans)

Failing test case input:
02B1

Expected output:
01


Actual output:
021


Fixed submission (verdict: Accepted):
s = input()
ans = ""
for k in s:
  if k == 'B':
    if ans != "":
      ans = ans[:len(ans)-1]
  else:
    ans += k
print(ans)

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=str(input())
C= list(s)
list=[]
for I in range(len(C)):
    if I!='B':
        list.append(C[I])
    elif I=='B':
        list.pop()
 
print("".join(list))

Failing test case input:
BB00

Expected output:
00


Actual output:
BB00


Fixed submission (verdict: Accepted):
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))
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
p = ''
for i in range(len(s)):
    if s[i] == 'B':
        if i != 0:
            p = p[:-1]
    else:
        p += s[i]
print(p[::-1])

Failing test case input:
BB01

Expected output:
01


Actual output:
10


Fixed submission (verdict: Accepted):
s = input()
p = ''
for i in range(len(s)):
    if s[i] == 'B':
        if 1 <= len(p):
            p = p[:-1]
    else:
        p += s[i]
print(p)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
ret = []
for s in S:
    if s == 'B' and len(ret):
        ret.pop()
    else:
        ret.append(s)
print(''.join(ret))

Failing test case input:
B.00

Expected output:
.00


Actual output:
B.00


Fixed submission (verdict: Accepted):
S = input()
ret = []
for s in S:
    if s == 'B':
        if len(ret):
            ret.pop()
    else:
        ret.append(s)
print(''.join(ret))

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
/B10

Expected output:
10


Actual output:
01


Fixed submission (verdict: Accepted):
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])

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
t=""
for i in input():
    if i=="B":
        t=t[:-1]
    else:
        t+=i
    print(t) 
        
    


Failing test case input:
1B.0

Expected output:
.0


Actual output:
1

.
.0


Fixed submission (verdict: Accepted):
t=""
for i in input():
    if i=="B":
        t=t[:-1]
    else:
        t+=i
print(t)

Problem: p04030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
b = 0
for i in range(len(s)-1,-1,-1):
  if s[i] == 'B':
    b += 1
  else:
    if b > 0:
      b -= 1
    else:
      print(s[i], end='')
print()

Failing test case input:
B001

Expected output:
001


Actual output:
100


Fixed submission (verdict: Accepted):
s = input()
ans_rev = ''
b = 0
for i in range(len(s)-1,-1,-1):
  if s[i] == 'B':
    b += 1
  else:
    if b > 0:
      b -= 1
    else:
      ans_rev += s[i]
for i in range(len(ans_rev)-1, -1,-1):
  print(ans_rev[i], end='')
print()

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()

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

Failing test case input:
B3B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
S = input()

F = []
for ch in S:
  if ch == "B": 
    if len(F) > 0:
      F.pop()
  else:
    F.append(ch)
    
print("".join(F))
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
ans = ""
for s in input():
    if s == "B":
        if ans:
            ans = ans[:-2]
    else:
        ans += s
else:
    print(ans)

Failing test case input:
01B0

Expected output:
00

Actual output:
0


Fixed submission (verdict: Accepted):
ans = ""
for s in input():
    if s == "B":
        if ans:
            ans = ans[:-1]
    else:
        ans += s
else:
    print(ans)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))



Failing test case input:
111B

Expected output:
11


Actual output:
111


Fixed submission (verdict: Accepted):
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)
        ans[index] = ""

print("".join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


S = str(input())

w = ""
if S[0] == "B":
  w = ""
else :
  w = w + S[0]

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

print(w)

Failing test case input:
00B0

Expected output:
00


Actual output:
0


Fixed submission (verdict: Accepted):


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)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())

s.reverse()

print(''.join(s))

b = 0
ans = ''
for c in s:
    if c == 'B':
        b += 1
    else:
        if b > 0:
            b -= 1
            continue
        else:
            ans += c

ans = list(ans)
ans.reverse()
print(''.join(ans))



Failing test case input:
CB01

Expected output:
01


Actual output:
10BC
01


Fixed submission (verdict: Accepted):
s = list(input())
s.reverse()
b = 0
ans = ''

for c in s:
    if c == 'B':
        b += 1
    else:
        if b > 0:
            b -= 1
        else:
            ans += c

ans = list(ans)
ans.reverse()
print(''.join(ans))
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
ans = [''] * len(S)
cur = 0
for s in S:
    if s == 'B':
        ans[cur] = ''
        cur -= 1
        cur = max(0, cur)
    else:
        ans[cur] = s
        cur += 1

print("".join(ans))

Failing test case input:
101B

Expected output:
10


Actual output:
101


Fixed submission (verdict: Accepted):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()
ans = [''] * len(S)
cur = 0
for s in S:
    if s == 'B':
        cur -= 1
        ans[cur] = ''
        cur = max(0, cur)
    else:
        ans[cur] = s
        cur += 1

print("".join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
d = 0
for i in s[::-1]:
    if i == 'B':
        d += 1
    elif d > 0:
        d -= 1
    else:
        print(i, end='')


Failing test case input:
0/B1

Expected output:
01


Actual output:
10

Fixed submission (verdict: Accepted):
s = input()
d = 0
m = []
for i in s[::-1]:
    if i == 'B':
        d += 1
    elif d > 0:
        d -= 1
    else:
        m.append(i)

for i in m[::-1]:
    print(i, end='')

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
ans=""
for x in s:
  if x == 'B' and len(ans)>0:
    ans=ans[:len(ans)-1]
  else:
    ans+=x
print(ans)

Failing test case input:
B/B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
s=input()
ans=""
for x in s:
  if x == 'B' and len(ans)>0:
    ans=ans[:len(ans)-1]
  else:
    if x != 'B':
      ans+=x
print(ans)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
ls=[]
for i in range(len(s)):
  if i!="B":
    ls.append(i)
  elif ls!=[]:
    del ls[-1]
print(*ls,sep="")

Failing test case input:
0CB0

Expected output:
00


Actual output:
0123


Fixed submission (verdict: Accepted):
s=input()
ls=[]
for i in range(len(s)):
  if s[i]!="B":
    ls.append(s[i])
  elif ls!=[]:
    del ls[-1]
print(*ls,sep="")

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
words="010B"
s=""
for word in words:
    if word=="B":
        s=s[:-1]
    else:
        s=s+word
print(s)

Failing test case input:
/B10

Expected output:
10


Actual output:
01


Fixed submission (verdict: Accepted):
words=input()
s=""
for word in words:
    if word=="B":
        s=s[:-1]
    else:
        s=s+word
print(s)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans = []
for i in s:
  if i == "B":
    if ans:
      ans.pop()
  else:
    ans.append(i)
print(*ans)

Failing test case input:
B011

Expected output:
011


Actual output:
0 1 1


Fixed submission (verdict: Accepted):
s = input()
ans = []
for i in s:
  if i == "B":
    if ans:
      ans.pop()
  else:
    ans.append(i)
print("".join(ans))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A =input()
B=""
for i in range(len(A)):
    if i==0:
        if A[i]!="B":
            B= B+A[i]
    else:
        if A[i] !="B":
            B=B+A[i]
        else:
            B = B[:i-1]
print(B)


            


Failing test case input:
B1B0

Expected output:
0


Actual output:
10


Fixed submission (verdict: Accepted):
A =input()
B=""
for i in range(len(A)):
    if i==0:
        if A[i]!="B":
            B= B+A[i]
    else:
        if A[i] !="B":
            B=B+A[i]
        else:
            B = B[:(len(B)-1)]
print(B)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def myAnswer(s:list)->str:
   ans = []
   for string in s:
      if(string == "B"):
         if(ans == []):
            continue
         else:
            ans.pop()
      else:
         ans.append(string)
   print(ans)
   return "".join(ans)

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

Failing test case input:
.BB0

Expected output:
0


Actual output:
['0']
0


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

   return "".join(ans)

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

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

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

Failing test case input:
B011

Expected output:
011


Actual output:
B01011


Fixed submission (verdict: Accepted):
s = input()

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

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
y=""
a=str(input())
print(len(a))
for i in range (len(a)):
    if a[i]=="B":
        y=y[:-1]
    else:
        y=y+a[i]
print(y)

Failing test case input:
.BB0

Expected output:
0


Actual output:
4
0


Fixed submission (verdict: Accepted):
y=""
a=str(input())
for i in range (len(a)):
    if a[i]=="B":
        y=y[:-1]
    else:
        y=y+a[i]
print(y)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inst = input()
buf = []
for s in inst:
  if s == "B" and len(buf) != 0:
    del buf[-1]
  else:
    buf.append(s)
print(buf)

Failing test case input:
3BB0

Expected output:
0


Actual output:
B, 0

Fixed submission (verdict: Accepted):
inst = input()
buf = []
for s in inst:
  if s == "B":
    if len(buf) != 0:
      del buf[-1]
  else:
    buf.append(s)
print("".join(buf))

Problem: p04030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
string = str(input())

str_len = len(string)

out_string = ""

for num in range(str_len):

    if string[num] == "0":
        out_string += "0"

    elif string[num] == "1":
        out_string += "1"

    elif string[num] == "B":
        if not len(out_string) == 0:
            out_string = out_string[:num-1]

print(out_string)

Failing test case input:
B.00

Expected output:
.00


Actual output:
00


Fixed submission (verdict: Accepted):
string = str(input())

str_len = len(string)

out_string = ""

for num in range(str_len):

    if string[num] == "B":
        if len(out_string) != 0:
            out_string = out_string[:-1]

    else:

        out_string += string[num]


print(out_string)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans = ''
for i in s:
    if i == 'B':
        ans = ans[:-1]
    else:
        ans += i
        print(ans)
print(ans)

Failing test case input:
B0.0

Expected output:
0.0


Actual output:
0
0.
0.0
0.0


Fixed submission (verdict: Accepted):
s = input()
ans = ''
for i in s:
    if i == 'B':
        ans = ans[:-1]
    else:
        ans += i
print(ans)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
ans = ""
for i in S:
  if i == "B":
    S = S[:-1]
  else:
    ans += i
print(ans)

Failing test case input:
B0B0

Expected output:
0


Actual output:
00


Fixed submission (verdict: Accepted):
S = input()
ans = ""
for i in S:
  if i == "B":
    ans = ans[:-1]
  else:
    ans += i
print(ans)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
01B1

Expected output:
01


Actual output:
11


Fixed submission (verdict: Accepted):
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)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans = []
for i in s:
    if i == 'B' and len(ans):
        ans.pop()
    else:
        ans.append(i)
print(''.join(ans))

Failing test case input:
B3B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
s = input()
ans = []
for i in s:
  if i == 'B':
    if len(ans):
      ans.pop()
  else:
    ans.append(i)
print(''.join(ans))
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
    if s[i] =="b" and s[i-1] == True:
        output[i-1] = "d"
    output.append(s[i])
output2 = [j for j in output if j.isdigit()]
print("".join(output2))

Failing test case input:
B0.0

Expected output:
0.0


Actual output:
00


Fixed submission (verdict: Accepted):
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
    if s[i] == "B":
        try:
            output.pop(-1)
        except:
            pass
    else:
        output.append(s[i])
print("".join(output))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
    if s[i] =="B" and s[i-1] == True:
        output[i-1] = "D"
    output.append(s[i])
output2 = [j for j in output if j.isdigit()]
print("".join(output2))


Failing test case input:
B1B0

Expected output:
0


Actual output:
10


Fixed submission (verdict: Accepted):
s = list(input())
len_s = len(s)
output = []
for i in range(0,len_s):
    if s[i] == "B":
        try:
            output.pop(-1)
        except:
            pass
    else:
        output.append(s[i])
print("".join(output))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inst = input()
buf = []
for s in inst:
  if len(buf) != 0 and s == "B":
    del buf[-1]
  else:
    buf.append(s)
print("".join(buf))

Failing test case input:
B01B

Expected output:
0


Actual output:
B0


Fixed submission (verdict: Accepted):
inst = input()
buf = []
for s in inst:
  if s == "B":
    if len(buf) != 0:
      del buf[-1]
  else:
    buf.append(s)
print("".join(buf))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
b = []

for i in s:
    if i == 'B':
        print('e')
        if len(b) != 0:
            b.pop()
    else:
        b.append(i)
    
print(''.join(b))

Failing test case input:
/B01

Expected output:
01


Actual output:
e
01


Fixed submission (verdict: Accepted):
s = input()
b = []

for i in s:
    if i == 'B':
        if len(b) != 0:
            b.pop()
    else:
        b.append(i)
    
print(''.join(b))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()

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

print("".join(result))


Failing test case input:
1BB0

Expected output:
0


Actual output:
B0


Fixed submission (verdict: Accepted):
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))
Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
output_s = ""

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

Failing test case input:
B1B1

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
s = input()
output_s = ""

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

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
from collections import deque
input = stdin.readline

s = input()
d = deque([])

for i in s:
    if s != "B":
        d.append(s)
    else:
        if d:
            d.pop()
        else:
            pass

print("".join(d))


Failing test case input:
/BB1

Expected output:
1


Actual output:
/BB1
/BB1
/BB1
/BB1
/BB1



Fixed submission (verdict: Accepted):
from sys import stdin
from collections import deque
input = stdin.readline

s = input().rstrip()
d = deque([])

for i in s:
    if i != "B":
        d.append(i)
    else:
        if d:
            d.pop()
        else:
            pass

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

print()

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
cha = list(S)
plist = []

for i in cha:
    if plist!=[] and i != "B":   
        if i == "B":
            del plist[-1]
        else:
            plist.append(i)

plist = "".join(plist)

print(plist)

Failing test case input:
00B1

Expected output:
01


Actual output:

Fixed submission (verdict: Accepted):
S = input()
cha = list(S)
plist = []

for i in cha: 
    if i == "B":
        if plist != []:
            del plist[-1]
    else:
        plist.append(i)
            
plist = "".join(plist)

print(plist)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = str(input())

b = list(a)

c = len(b)

strs = []

for i in range(c):
  if b[i] == 'B':
    if i == 0 or len(strs) == 0 or b[i-1] == 'B':
      continue
    else:
      strs = strs[:1]
  else:
    strs.append(b[i])

print(''.join(strs))


Failing test case input:
.BB0

Expected output:
0


Actual output:
.0


Fixed submission (verdict: Accepted):
a = str(input())

b = list(a)

c = len(b)

strs = []

for i in range(c):
  if b[i] == 'B':
      strs = strs[:-1]
  else:
    strs.append(b[i])

print(''.join(strs))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve():
    s = list(input())

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

    return ''.join(ans)

    
print(solve())


Failing test case input:
101B

Expected output:
10


Actual output:
01


Fixed submission (verdict: Accepted):
def solve():
    s = list(input())

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

    return ''.join(ans)

    
print(solve())
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

s = IS()
a = ""
for txt in s:
    if txt != "B":
        a += txt
    else:
        if len(a) != 0:
            a = a.rstrip(a[-1])
print(a)

Failing test case input:
111B

Expected output:
11


Actual output:

Fixed submission (verdict: Accepted):

import sys


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

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

Problem: p04030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s=input()
x=''
for i in s:
    if i=='B':
        if x!='':
            x=x.replace(x[-1],'')
    else:
        x+=i
print(x)


Failing test case input:
11B1

Expected output:
11


Actual output:
1


Fixed submission (verdict: Accepted):
s=input()
x=''
for i in s:
    if i=='B':
        if x!='':
            x=x[:-1]
    else:
        x+=i
print(x)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = ""
for i in input():
  if(i == "B" and a != ""):
    a = a[:len(a)-1]
  else:
    a += i
print(a)

Failing test case input:
B01B

Expected output:
0


Actual output:
B0


Fixed submission (verdict: Accepted):
a = ""
for i in input():
  if(i == "B"):
    if(a != ""):
	    a = a[:len(a)-1]
  else:
    a += i
print(a)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans = ''
for x in s :
     if x == 'B' :
          if not ans == '' : ans = ans.rstrip(ans[-1])
     else : ans += x
print(ans)

Failing test case input:
00B1

Expected output:
01


Actual output:
1


Fixed submission (verdict: Accepted):
s = input()
ans = ''
for x in s :
     if x == 'B' :
          ans = ans[:-1]
     else : ans += x
print(ans)

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=str(input())
ans=""
for i in range(len(S)):
    if S[i]=="B":
        ans=ans[:i-1]
    else:
        ans+=S[i]
print(ans)

Failing test case input:
B2B0

Expected output:
0


Actual output:
20


Fixed submission (verdict: Accepted):
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)
Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
ans=[]
for x in s:
    if x=='B' and len(ans)>0:
        del(ans[len(ans)-1])
    else :
        ans.append(x)
for x in ans:
    print(x,end="")


Failing test case input:
B011

Expected output:
011


Actual output:
B011

Fixed submission (verdict: Accepted):
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="")

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
answer=""
for c in s:
  if c != "B":
    answer+=c
  elif answer != "":
    answer = answer[0:len(answer)]
  else:
    continue
print(answer)

Failing test case input:
03B0

Expected output:
00


Actual output:
030


Fixed submission (verdict: Accepted):
s=input()

answer=""

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

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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 = 0
print(news)

Failing test case input:
11B0

Expected output:
10


Actual output:
01


Fixed submission (verdict: Accepted):
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])

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
m = input()
l = []

for char in m:
    l.append(char)

k = []

for i in range(len(l)):
    if i > 0:
        if l[i] == "B":
            k = k[:(i-1)]
        else: k.append(l[i])
    else: 
        if l[i] == "B":
            
            pass
        else: k.append(l[i])

result = ""
for j in k:
    result += j

print(result)

Failing test case input:
B1B0

Expected output:
0


Actual output:
10


Fixed submission (verdict: Accepted):
m = input()
l = []

for char in m:
    l.append(char)

k = []

for i in range(len(l)):
        if l[i] == "B":
            if k == []:
                pass
            else: k = k[:(len(k))-1]
        else: k.append(l[i])

result = ""
for j in k:
    result += j

print(result)

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
txt = []

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

print(''.join(txt))


Failing test case input:
B11B

Expected output:
1


Actual output:
B1


Fixed submission (verdict: Accepted):
s = input()
txt = []

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

print(''.join(txt))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
x = ''
for i in s:
    if i == 'B':
        x += i
    else:
        x = x[:-1]
print(x)


Failing test case input:
011B

Expected output:
01


Actual output:
B


Fixed submission (verdict: Accepted):
s = input()
x = ''
for i in s:
    if i == 'B':
        x = x[:-1]
    else:
        x += i
print(x)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
p = ''
for i in range(len(s)):
    if s[i] == 'B':
        if len(p) != 0:
            p = p[:-1]
    else:
        p += s[i]
print(p[::-1])

Failing test case input:
10B0

Expected output:
10


Actual output:
01


Fixed submission (verdict: Accepted):
s = input()
p = ''
for i in range(len(s)):
    if s[i] == 'B':
        if 1 <= len(p):
            p = p[:-1]
    else:
        p += s[i]
print(p)

Problem: p04030
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
string = str(input())

str_len = len(string)

out_string = ""

for num in range(str_len):

    if string[num] == "0":
        out_string += "0"

    elif string[num] == "1":
        out_string += "1"

    elif string[num] == "B":
        out_string = out_string[:num-1]

print(out_string)

Failing test case input:
B0.0

Expected output:
0.0


Actual output:
00


Fixed submission (verdict: Accepted):
string = str(input())

str_len = len(string)

out_string = ""

for num in range(str_len):

    if string[num] == "B":
        if len(out_string) != 0:
            out_string = out_string[:-1]

    else:

        out_string += string[num]


print(out_string)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


S = str(input())

w = ""
for i in range(len(S)):
  if S[i] == "B":
    if w == "":
      w = ""
    else :
      w = w.rstrip()
  else:
    w = w + S[i]

print(w)


Failing test case input:
03B0

Expected output:
00


Actual output:
030


Fixed submission (verdict: Accepted):


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)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())
res=[]
for i in s:
    if i=="b":
        res=res[:-1]
    else:
        res.append(i)
res="".join(res)
print(res)

Failing test case input:
100B

Expected output:
10


Actual output:
100B


Fixed submission (verdict: Accepted):
s=list(input())
res=[]
for i in s:
    if i=="B":
        res=res[:-1]
    else:
        res.append(i)
print("".join(res))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())

S = []
for i in s:
    if i == 'B':
        if S != []:
            S.pop(-1)
        else:
            pass
    else:
        S.append(i)
S_s = ''
for i in S:
    S_s += i
    
print(i)

Failing test case input:
B010

Expected output:
010


Actual output:
0


Fixed submission (verdict: Accepted):
s = list(input())

S = []
for i in s:
    if i == 'B':
        if S != []:
            S.pop(-1)
        else:
            pass
    else:
        S.append(i)
S_s = ''
for i in S:
    S_s += i
    
print(S_s)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
s_list = list(s)
count = s.count('B')
for _ in range(count):
  ind = s_list.index('B')
  s_list[ind-1] = ''
s = ''.join(s_list)
s = s.replace('B','')
print(s)

Failing test case input:
BB01

Expected output:
01


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
s_list = list(s)
count = s.count('B')
for _ in range(count):
  ind = s_list.index('B')
  if ind > 0:
    s_list[ind-1] = ''
  s_list[ind] = ''
  s = ''.join(s_list)
  s_list = list(s)
s = ''.join(s_list)
print(s)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

Failing test case input:
B00B

Expected output:
0


Actual output:
00


Fixed submission (verdict: Accepted):


S =input()
ANS = ""
for _ in S:
    if _ =="B":
        ANS =ANS[:-1]
    else:
        ANS +=_
print(ANS)

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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.remove(lis[-1])
    for j in range(len(lis)):
        ans += lis[j]
    print(ans)
resolve()

Failing test case input:
101B

Expected output:
10


Actual output:
01


Fixed submission (verdict: Accepted):
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()

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = input()
s=""
for i in range(len(n)):
    if(n[i]=="B" and s != ""):
        s=s[:-1]
    else:
        s+=n[i]
print(s)
        


Failing test case input:
B110

Expected output:
110


Actual output:
B110


Fixed submission (verdict: Accepted):
n = input()
s=""
for i in range(len(n)):
    if(n[i]=="B"):
        if(s != ""):
            s=s[:-1]
    else:
        s+=n[i]
print(s)

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
111B

Expected output:
11


Actual output:
1


Fixed submission (verdict: Accepted):
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)
Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
print(s)
ans = ''
for i in s:
    if i != 'B':
        ans += i
    else:
        ans = ans[:-1]
print(ans)

Failing test case input:
DB10

Expected output:
10


Actual output:
DB10
10


Fixed submission (verdict: Accepted):
s = input()

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

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
ans=""

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

Failing test case input:
100B

Expected output:
10


Actual output:
1


Fixed submission (verdict: Accepted):
s=input()
ans=""

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

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inst = input()
buf = []
for s in inst:
  if s == "B" and len(buf) != 0:
    del buf[-1]
  else:
    buf.append(s)
print("".join(buf))

Failing test case input:
B01B

Expected output:
0


Actual output:
B0


Fixed submission (verdict: Accepted):
inst = input()
buf = []
for s in inst:
  if s == "B":
    if len(buf) != 0:
      del buf[-1]
  else:
    buf.append(s)
print("".join(buf))

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
stack = []
stack.append(S.pop(0))

for s in S:
    if s == "B":
        if len(stack) > 0:
            stack.pop()
    else:
        stack.append(s)

print("".join(stack))


Failing test case input:
B00B

Expected output:
0


Actual output:
B0


Fixed submission (verdict: Accepted):
S = list(input())
stack = []

for s in S:
    if s == "B":
        if len(stack) > 0:
            stack.pop()
    else:
        stack.append(s)

print("".join(stack))

Problem: p04030
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    s=input()
    li=[]
    for i in range(len(s)):
        if(s[i]!='B'):
            li.append(s[i])
        else:
            if(len(li)!=0):
                li.pop()
    for i in range(len(li)):
        print(i,end='')

main()


Failing test case input:
101B

Expected output:
10


Actual output:
01

Fixed submission (verdict: Accepted):
def main():
    s=input()
    li=[]
    for i in range(len(s)):
        if(s[i]!='B'):
            li.append(s[i])
        else:
            if(len(li)!=0):
                li.pop()
    for i in li:
        print(i,end='')

main()

Problem: p04030
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
ss=input().split()
r=''
for i, s in enumerate(ss):
  if s!='B':
    r+=s
  elif len(r)>0:
    r=r[:-1]
print(r)



Failing test case input:
B111

Expected output:
111


Actual output:
B111


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