Problem:


Score : 200 points

Problem Statement

Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key.

To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is empty. When each key on the keyboard is pressed, the following changes occur to the string:

The 0 key: a letter 0 will be inserted to the right of the string.

The 1 key: a letter 1 will be inserted to the right of the string.

The backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted.

Sig has launched the editor, and pressed these keys several times. You are given a string s, which is a record of his keystrokes in order. In this string, the letter 0 stands for the 0 key, the letter 1 stands for the 1 key and the letter B stands for the backspace key. What string is displayed in the editor now?

Constraints

1 ≦ |s| ≦ 10 (|s| denotes the length of s)

s consists of the letters 0, 1 and B.

The correct answer is not an empty string.

Input

The input is given from Standard Input in the following format:

s

Output

Print the string displayed in the editor in the end.

Sample Input 1

01B0

Sample Output 1

00

Each time the key is pressed, the string in the editor will change as follows: 0, 01, 0, 00.

Sample Input 2

0BB1

Sample Output 2

1

Each time the key is pressed, the string in the editor will change as follows: 0, (empty), (empty), 1.



Sample input:
01B0


Sample output:
00

Submission status: Accepted

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

for i in range(len(s)):
  if s[i] == '0':
    ans_list.append('0')
  if s[i] == '1':
    ans_list.append('1')
  if ans_list == []:
    pass
  else:
    if s[i] == 'B':
      ans_list.pop(-1)

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

Submission status: Accepted

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

for i in s:
    if i == "B":
        if len(S) != 0:
            S.pop(-1)
        else:
            pass
    else:
        S.append(i)

print(*S, sep="")

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')
  elif s[i] == 'B' and len(L) > 0:
    del L[-1]

print(''.join(L))

Submission status: Accepted

Solution code:
s = input()
ans = []
for c in s:
    if c == 'B' and ans:
        ans.pop()
    elif c == '0' or c == '1':
        ans.append(c)
print(''.join(ans))

Submission status: Accepted

Solution code:
s = input()
s_list = [c for c in s]
output = []

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

print(''.join(output))

Submission status: Accepted

Solution code:
s=input()

text=[]
for i in s:
    if(i=='0'):
        text.append(0)
    elif(i=='1'):
        text.append(1)
    else:
        text=text[:-1]
t=''
for i in text:
    t+=str(i)
print(t)

Submission status: Accepted

Solution code:
s = input()

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s =str(input())

a=''

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

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
a = []
for i in range(n):
    if s[i] != 'B':
        a.append(s[i])
    else:
        if len(a) != 0:
            a.pop(-1)
t =''
m = len(a)
for j in range(m):
    t += a[j]
print(t)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = []
for _s in s:
    if _s == "0":
        ans.append(0)
    elif _s == "1":
        ans.append(1)
    elif _s == "B" and len(ans) > 0:
        ans.pop()

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

Submission status: Accepted

Solution code:
s = list(input())
t = []
for i in range(len(s)):
    if s[i] == '0':
        t.append('0')
    elif s[i] == '1':
        t.append('1')
    else:
        if t:
            del t[-1]
print(''.join(t))

Submission status: Accepted

Solution code:
s = list(input())
e = []
for i in range(len(s)):
    if e == []:
        if (s[i] == "0") or (s[i] == "1"):
            e.append(s[i])
    else:
        if (s[i] == "0") or (s[i] == "1"):
            e.append(s[i])
        else:
            del e[-1]
f = "".join(e)
print(f)

Submission status: Accepted

Solution code:
s=list(input())

for i in range(len(s)):
    if(s[i]=="B"):
        s[i]="A"
        for j in range(i,-1,-1):
            if((s[j]=="0")|(s[j]=="1")):
                s[j]="A"
                break

for C in s:
    if(C!="A"):
        print(C,end="")

Submission status: Accepted

Solution code:
arr =list(input())
ret=""
for st in arr:
  if(st == "B"):
    ret = ret[:len(ret)-1]
  else:
    ret = ret + st
      
print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = []
for i in s:
    if i =='B':
        try:
            ans.pop()
        except:
            continue
    else:
        ans.append(i)
print("".join(i for i in ans))

Submission status: Accepted

Solution code:
input_line = input()
str = ""

for i in range(0,len(input_line)):
  if input_line[i] == '0':
    str += "0"
  elif input_line[i] == '1':
    str += "1"
  elif input_line[i] == 'B':
    str = str[:-1]
else:
  print(str)

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:
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
q = deque([])
L = ''
for i in range(len(s)):
    if s[i] == '0':
        q.append('0')
    elif s[i] == '1':
        q.append('1')
    else:
        if q:
            q.pop()
while q:
    L += q.popleft()
print(L)

Submission status: Accepted

Solution code:
s = input()
letters = [letter for letter in s]

res = []

for letter in letters:
    if letter == "B":
        if res:
            res.pop()
    else:
        res.append(letter)

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

Submission status: Accepted

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

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

for j in range(len(s)):
    # print("j=%d word=%s length=%d ans=%s" % (j, s[j], len(ans), "".join(ans)))
    if (s[j]) == "B":
        l = len(ans)
        if l == 0:
            continue
        else:
            del ans[-1]
    else:
        ans.append(s[j])

print("".join(ans))

Submission status: Accepted

Solution code:
slist=list(input())
alist=[]
for i in slist:
	if i=="B":
		alist=alist[:-1]
	else:
		alist.append(i)
print(*alist,sep="")

Submission status: Accepted

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

Submission status: Accepted

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

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

print(''.join(w))

Submission status: Accepted

Solution code:
s = input()

ans = ""

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

Submission status: Accepted

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

ans = ""
for j in ans_l:
    ans = ans + j

print(ans)

Submission status: Accepted

Solution code:
#2019/10/22
#s = open(0).read()
s = input()
display = []
for i in s:
    if i == "0":
        display.append("0")
    elif i == "1":
        display.append("1")
    else:
        if display == []:
            continue
        else:
            display.pop(-1)

#print(display)
ans="".join(display)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
tmp = []
for i in S:
    if i == '0' or i == '1':
        tmp.append(i)
    else:
        if len(tmp) == 0:
            continue
        else:
            tmp.pop()
print(''.join(tmp))

Submission status: Accepted

Solution code:
# ABC043 B - バイナリハックイージー / Unhappy Hacking (ABC Edit)
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

S = si()
ans = ''
for s in S:
    if s == '0':
        ans += '0'
    elif s == '1':
        ans += '1'
    elif s == 'B':
        n = len(ans)
        if n > 0:
            ans = ans[0:n-1]
print(ans)

Submission status: Accepted

Solution code:
from itertools import groupby as gb
s=""
for i,b in gb(input()):
  if i=="B":
    s=s[:-len(list(b))]
  else:s+=i*len(list(b))
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(str(input()))

r = ''
for i in s:
  if i == 'B' and r == '':
    continue
  if i == 'B':
    r = r[:-1]
    continue
  r += i
  
print(r)

Submission status: Accepted

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

for k in s:
  if(k == "0" or k == "1"):
    result += k
  else:
    if(result != ""):
      result = result[:-1]
      
print(result)

Submission status: Accepted

Solution code:
s = input()
j = 0
for i in range(len(s)):
    #print("i=",i)
    if s[i-(2*j)] == "B":
        #print(i-(2*j))
        #print(s)
        if s[0] == "B":
            s = 'x'+s[1:]
            #print(s)
            #print(s[0])
        else:
            #print(i-(2*j))
            s = s[:i-1-(2*j)]+s[i-(2*j)+1:]
            j += 1
            
            #print("s=",s)
            #print(s[:i-1-(2*j)-1])
ans = s.replace('x','')
print(ans)

Submission status: Accepted

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

def delete_letter(result):
    if len(result) == 0:
        return result
    return result[:-1]


s = input()
result = ''
for c in s: 
    if c == 'B':
        result = delete_letter(result)
    else:
        result += c

print(result)

Submission status: Accepted

Solution code:
s = [str(i) for i in list(str(input()))]
x = list()
for i in s:
    if i == "0" or i == "1":
      x.append(i)
    elif i== "B" and x != []:
        x.pop(-1)
print(','.join(x).replace(",",""))

Submission status: Accepted

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

for s in S:
  if s == 'B':
    if stack:stack.pop()
  else:
    stack.append(s)
    
    
print(*stack, sep = '')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque


def check(s):
    queue = deque()

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

    return ''.join(queue)


def main():
    S = input()
    result = check(s=S)
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
buff=[]
for x in s:
  if x == "0" or x == "1":
    buff.append(x)
  else:
    if len(buff) > 0:
      buff.pop()
print("".join(buff))

Submission status: Accepted

Solution code:
s = list(input())

memo = 0
a = [-1 for i in range(10)]

for i in range(len(s)):
    if s[i] == '0':
        a[memo] = 0
        memo += 1
    elif s[i] == '1':
        a[memo] = 1
        memo += 1
    elif s[i] == 'B' and memo >0:
        memo -= 1
    
for i in range(memo):
    if a[i] != -1:
        print(a[i],end ="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
S = list(input())

R = ''

for s in S:
    if s == 'B':
        R = R[:-1]
    else:
        R = R + s

print(R)

Submission status: Accepted

Solution code:
s = input()

out = []
bc = 0
for j in range(len(s) - 1, -1, -1):
    if s[j] == 'B':
        bc += 1
    elif bc > 0:
        bc -= 1
    else:
        out.append(s[j])
ans = "".join(reversed(out))
print(ans)

Submission status: Accepted

Solution code:
s = input()
ans = []
for op in s:
    if op == '0':
        ans.append(op)
    elif op == '1':
        ans.append(op)
    else:
        if len(ans) > 0:
            ans.pop()
ss = ""
i = 0
for i in ans:
    ss += i
print(ss)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(len(List)):
  if List[i] == '0': ans.append('0')
  elif List[i] == '1': ans.append('1')
  else:
    if ans == []: pass
    else: ans.pop(-1)
      
for i in range(len(ans)):
  print(ans[i], end = '')

Submission status: Accepted

Solution code:
s = list(input())

ans = ""
add = ""

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

if len(ans) == 0:
    for i in range(len(s)):
        if s[i] != "B":
            add = s[i]
    ans = add

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
S = input()

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

print(s)

Submission status: Accepted

Solution code:
s = list(input())

ans = []
for i in s:
    if i != 'B':
        ans.append(i)
    else:
        if ans == []:
            pass
        else:
            ans.pop()

print (*ans, sep = '')

Submission status: Accepted

Solution code:

if __name__ == "__main__":
    word = input()
    res = []
    for letter in word:
        if letter == 'B':
            if len(res) != 0:
                res.pop()
        else:
            res.append(letter)
    print("".join(res))

Submission status: Accepted

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

Submission status: Accepted

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

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":
        if ans != []:
            ans.pop()
print(*ans, sep="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

s = input()

while 'B' in s:
    s = re.sub(r'[01]B', '', s)
    s = re.sub(r'^B+', '', s)
print(s)

Submission status: Accepted

Solution code:
import re

s = input()

while 'B' in s:
    s = re.sub(r'^B+', '', s)
    s = re.sub(r'[01]B', '', s)
print(s)

Submission status: Accepted

Solution code:
import re

s = input()

while re.search(r'B', s):
    s = re.sub(r'^B+', '', s)
    s = re.sub(r'[01]B', '', s)
print(s)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
### 2019/10/09
### 自由群

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
s=input()
while 'B' in s:
    s=s.lstrip('B')
    s=re.sub(r'[0,1]B','',s)
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = []
for _ in s:
    if _ == '0':
        ans.append('0')
    elif _ == '1':
        ans.append('1')
    elif ans != []:
        ans.pop(-1)

print(*ans, sep='')

Submission status: Accepted

Solution code:
s=input()
a=[]
for i in range(len(s)):
    if s[i]=='B':
        if len(a)>0:
            a.pop(-1)
    else:
        a.append(s[i])
print(*a,sep='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
w = ""
for k in s:
    if k == "B" and len(w) > 0:
        w = w[:-1]
    if k in ["0", "1"]:
        w += k
print(w)

Submission status: Accepted

Solution code:
import re
s = input()
for i in range(4):
  s = re.sub("[0-1]B","",s)
print(s.replace("B",""))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input().strip()
ans = ''
for c in S:
  if c == 'B':
    if len(ans) > 0:
      ans = ans[:-1]
  else:
    ans += c
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    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))


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
s = input()
r = []
for i in s:
  if i == "B":
    if r:
      del r[-1]
  else:
    r.append(i)
print(*r, sep="")

Submission status: Accepted

Solution code:
s = input()
l = list(s)
r = []
for i in l:
  if i == "0":
    r.append("0")
  elif i =="1":
    r.append("1")
  else:
    if r == []:
      continue
    else:
      del r[-1]
print(*r, sep="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
answer=[]
for i in range (len(N)):
    if(N[i] == "B"):
        if(answer):
            answer.pop()
    else:
        answer.append(N[i])
print("".join(answer))

Submission status: Accepted

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

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

print(''.join(ans))

Submission status: Accepted

Solution code:
S = input()
stack = []
for s in S:
    if s != "B":
        stack.append(s)
    elif not stack:pass
    else:stack.pop()
print(*stack,sep="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input_list = input()
out_list=list()
for i in range(len(input_list)):
    if input_list[i] == "0":
        out_list.append('0')
        i +=1
    elif input_list[i] == "1":
        out_list.append('1')
        i +=1
    else:
        if not len(out_list)==0:
            out_list.pop()
for j in out_list:
    print(j,end="")

Submission status: Accepted

Solution code:
# coding: utf-8
orders = list(input())
out_list = []
for od in orders:
  if od == "0":
    out_list.append("0")
  elif od == "1":
    out_list.append("1")
  elif od == "B":
    if len(out_list) != 0:
      out_list.pop(-1)
out_str = "".join(out_list)
print(out_str)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

result = ""
for ch in s:
  if ch == "B":
    result = result[:-1]
  else:
    result += ch

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())

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

Submission status: Accepted

Solution code:
s = input()
ans =''
for i in s:
  if i =='1':
    ans+='1'
  elif i=='0':
    ans+='0'
  elif i=='B':
      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"
    elif c == "B":
        ans = ans[:-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for ch in S:
    if ch == 'B':
        if result: result.pop()
        continue
    result.append(ch)

print(''.join(result))

Submission status: Accepted

Solution code:
t = ""

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

print(t)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
key = list(input())
k = []

for n in key:
  if n == "0" or n == "1":
    k.append(n)
  elif len(k) != 0:
    k.pop()
  else:
    pass
  
print("".join(k))

Submission status: Accepted

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

s = input()

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

ans = "".join(ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
ANS = []
s = input()
for i in s:
    if i == "B":
        try:
            ANS.pop(-1)
        except:
            continue
    else:
        ANS.append(i)
print("".join(ANS))

Submission status: Accepted

Solution code:
s=list(input())
ans=[]
while s:
    x=s.pop(0)
    if x=='0': ans.append('0')
    elif x=='1': ans.append('1')
    elif x=='B' and len(ans): ans.pop()
print(''.join(ans))

Submission status: Accepted

Solution code:
s = list(input())
result = ""
for one_command in s:
  if one_command == "B":
    if len(result) != 0:
      result = result[:-1]
  else:
    result += one_command
print(result)

Submission status: Accepted

Solution code:
import collections

S=input()
N=len(S)
D=collections.deque([])

for i in range(N):
  if S[i]=="B":
    if len(D):
      D.pop()
  else:
    D.append(S[i])
print("".join(list(D)))

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ans = ""
for i in S:
    if ans == "" and i == "B":
        pass
    elif i == "B":
        ans = ans[0:-1]
    else:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')


S=input()
ans=""

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