Problem:


Score : 200 points

Problem Statement

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

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

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

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

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

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

Constraints

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

s consists of the letters 0, 1 and B.

The correct answer is not an empty string.

Input

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

s

Output

Print the string displayed in the editor in the end.

Sample Input 1

01B0

Sample Output 1

00

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

Sample Input 2

0BB1

Sample Output 2

1

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



Sample input:
01B0


Sample output:
00

Submission status: Accepted

Solution code:
import re
s = input()
for _ in range(s.count('B')):
    s = re.sub(r'(^|[01])B', '', s)
print(s)

Submission status: Accepted

Solution code:
s=input()
while'B'in s:
    s=s.replace('0B','').replace('1B','')
    if s[0]=='B':s=s[1:]
print(s)

Submission status: Accepted

Solution code:
s = list(input())

output_string = []

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

print("".join(output_string))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=raw_input()
buf = []
for c in s:
  if c == '0':
    buf.append('0')
  elif c == '1':
    buf.append('1')
  elif c == 'B':
    if len(buf) > 0:
      buf = buf[:-1]
print ''.join(buf)

Submission status: Accepted

Solution code:
S = input()[::-1]
res = ""

ruiseki = 0
for s in S:
    if s == 'B':
        ruiseki += 1
    else:
        if ruiseki > 0:
            ruiseki -= 1
        else:
            res += s
print(res[::-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s =list(input())
a = []
for i in range(len(s)):
    if s[i] == 'B':
        if a == []:
            pass
        else:
            del a[-1]
    else :
        a += s[i]

print(''.join(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
data =[]
for i in range(len(s)):
  data.append(s[i])
array = []
for i in range(len(data)):
  if data[i] == "0":
    array.append("0")
  elif data[i] == "1":
    array.append("1")
  elif (len(array) != 0 and data[i]== "B"):
    array.pop(-1)
  else:
    pass

mojiretu = ''

for x in array:
    mojiretu += x

print(mojiretu)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

#print(S)
ans = []

for str in S:
    if str == '0':
        ans.append('0')
    elif str == '1':
        ans.append('1')
    else:
        if len(ans) > 0:
            ans.pop()
            

for a in ans:
    print(a,end ="")


print()

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input()
    result = []
    for c in s:
        if c == '0' or c == '1':
            result.append(c)
        elif c == 'B' and len(result) > 0:
            result.pop()
    print("".join(result))

Submission status: Accepted

Solution code:
a=list(input())
x=[]
for ai in a:
  if x !=[] and ai=="B":
    x.pop()
  elif ai in ["0","1"]:
    x.append(ai)
print("".join(x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(t)

Submission status: Accepted

Solution code:
def main():
    s = input()
    d = ""
    
    for i in s:
        if i == "0":
            d += "0"
        elif i == "1":
            d += "1"
        else:
            d = d[:-1]
            
    print(d)
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
s = list(s)
ans = []
for i in s:
    if i == "0" or i == "1":
        ans.append(i)
    else:
        try:
            del ans[-1]
        except:
            continue

    
print("".join(ans))

Submission status: Accepted

Solution code:
# coding: utf-8
ANS = []

for ch in list(input()):
    if ch == '0':
        ANS.append(ch)
    elif ch =='1':
        ANS.append(ch)
    else:
        if ANS:
            ANS.pop()

print(''.join(ANS))

Submission status: Accepted

Solution code:
S = input()
Ans_list = []
Ans = ''
for i in S:
	if i != 'B':
		Ans_list.append(i)
	elif i == 'B' and Ans_list != []:
		Ans_list.pop()
for i in Ans_list:
	Ans += i
print(Ans)

Submission status: Accepted

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

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

for word in ans:
    print(word ,end="")

Submission status: Accepted

Solution code:
import re
s = input()
for i in range(s.count('B')):
    s = re.sub(r'^B', '', s)
    s = re.sub(r'(0|1)B', '', s)
print(s)

Submission status: Accepted

Solution code:
in1 = input()
r = ""
for c in in1:
  if c == "0":
    r+="0"
  elif c == "1":
    r+="1"
  else:
    r = r[:-1]
print(r)

Submission status: Accepted

Solution code:
sl = input()

output = []
for s in sl:
    if s == "B":
        output = output[:-1]
    elif s == "0":
        output.append("0")
    elif s == "1":
        output.append("1")
        
print("".join(output))

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

strdata=""
s = arr_data[0][0]


for v in s:
    
    if v=="0":
        
        strdata+="0"
        
    elif v=="1":

        strdata+="1"
    
    else:
        
        strdata=strdata[0:len(strdata)-1]

print(strdata)

Submission status: Accepted

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

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

print ans

Submission status: Accepted

Solution code:
s = input()
n=len(s)
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 c in s:
    if c=='B':
        ans = ans[:len(ans)-1]
    else:
        ans += c
print(ans)

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    s = input()
    result = ''

    for si in s:
        if si == '0' or si == '1':
            result += si
        elif si == 'B':
            if len(result) != 0:
                result = result[:len(result) - 1]

    print(result)

Submission status: Accepted

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

print(b)

Submission status: Accepted

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

for s in s_list:
    if s == "1" or s == "0":
        ans_list.append(s)
    elif ans_list != []:
        ans_list.pop()
        
print("".join(ans_list))

Submission status: Accepted

Solution code:
S = input()
T = ""
for w in S:
    if w == "B" and T != "":
        T=T[:-1]
    elif w != "B":
        T += w
print(T)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import io


def run(input: io.TextIOBase, output: io.TextIOBase):
    x = input.readline().strip()
    r = ""
    for i in x:
        if i == "B":
            r = r[0:-1]
        else:
            r += i

    output.write(r + '\n')


if __name__ == '__main__':
    run(sys.stdin, sys.stdout)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = [str(i) for i in input()]
stuckS = []
for i in range(len(S)):
    if S[i] == "B":
        if len(stuckS) == 0:
            continue
        else:
            stuckS.pop()
    else:
        stuckS.append(S[i])

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

Submission status: Accepted

Solution code:
S=input()

word="A"
word=word[:-1]
num=len(S)
for i in range(num):        
    if S[i]=="0":
        word+=str(0)
    elif S[i]=="1":
        word+=str(1)
    else:
        if len(word)!=0:
           word=word[:-1]
        else:
            word=word
    

print(word)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()

ret = ""
cnt = 0
for i in a:
    if i == "B":
        ret = ret[:-1:]
    else:
        ret += i
print(ret)

Submission status: Accepted

Solution code:
keystrokes = input()
word = []
for k in keystrokes:
    if k == '0' or k == '1':
        word.append(k)
    elif word:
        word.pop()
print(''.join(word))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

L = []

for i, ch in enumerate(S):
    if ch != 'B':
        L.append(ch)
    elif len(L) > 0:
        L = L[:-1]

print(''.join(L))

Submission status: Accepted

Solution code:
s = input()
slist = list(s)

rst = []

for i in range(0,len(s)):
	if slist[i] == '0':
		rst[len(rst):] = slist[i]
	elif slist[i] == '1':
		rst[len(rst):] = slist[i]
	elif slist[i]== 'B':
		if len(rst) == 0:
			rst == []
		else:
			rst[len(rst)-1:len(rst)] = ''
		
	

jd = "".join(rst)
print(jd)

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:
      ans.pop()
ans=''.join(ans)
print(ans)

Submission status: Accepted

Solution code:
inp = list(input())
s = []
for i in inp:
    if i == "0":
        s.append(i)
    if i == "1":
        s.append(i)
    if i == "B":
        if s == []:
            continue
        s.pop(-1)
n = ','.join(s)
n = n.replace(",", "")
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans_str = ''
for i in list(input()):
    if i == 'B':
        ans_str = list(ans_str)[:-1]
    else:
        ans_str += i
print(''.join(ans_str))

Submission status: Accepted

Solution code:
ans = []
for c in list(input()):
    if c == 'B':
        if len(ans) == 0: continue
        ans.pop()
    else:
        ans.append(c)
print(''.join(ans))
#なぜか自作のプログラムが全く通らないので拝借しました。

Submission status: Accepted

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

Submission status: Accepted

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

    ans = ""
    for c in s:
        if c in ("0", "1"):
            ans += c
        else:
            ans = ans[:-1]
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=list(input())
  
T=[]
for i in s:
    if i=="B" and T!=[]:
        T.pop()
    elif i!="B":
        T.append(i)
Ts=""
for i in T:
    Ts+=i

print(Ts)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc043/tasks/abc043_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(s):
    ans = []

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


def main(args):
    s = input().strip()
    ans = solve(s)
    print(*ans, sep='')


if __name__ == '__main__':
    main(sys.argv[1:])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())
ans = []
for i in range(0,len(n)):
    if n[i] == "0":
        ans.append("0")
    elif n[i] == "1":
        ans.append("1")
    else:
        ans = ans[:-1]
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

print (z)

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:
N = input()
ans = str()
for i in range(len(N)):
    if N[i] == "0":
        ans += "0"
    elif N[i] == "1":
        ans += "1"
    else:
        if len(ans) == 0:
            continue
        else:
            ans = ans[:-1]

print(ans)

Submission status: Accepted

Solution code:
s = input()
lst = []
for i in range(len(s)):
    if s[i] == "B":
        if lst:
            del lst[len(lst)-1]
    else:
        lst.append(s[i])

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

Submission status: Accepted

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

for i in s:
   if i == "0" or i =="1":
      a.append(i)
   elif i =="B" and a !=[]:
      a.pop(-1)
   elif i =="B" and a ==[]:
      continue

print(''.join(a))

Submission status: Accepted

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

Submission status: Accepted

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

for s in S:
    if (s == "B") & (len(ans) != 0):
        del ans[-1]
    elif s == "1":
        ans.append("1")
    elif s == "0":
        ans.append("0")

print("".join(ans))

Submission status: Accepted

Solution code:

cmd = input()
now = ""

for c in cmd:
    if c == 'B':
        now = now[:-1]
    else:
        now = now + c

print(now)

Submission status: Accepted

Solution code:
val = list(input())
res = []
for i in val:
    if i == "0":
        res.append("0")
    elif i == "1":
        res.append("1")
    else:
        if len(res) != 0:
            res.pop()
print("".join(res))

Submission status: Accepted

Solution code:
s=list(input())
total=[]
for i in range(len(s)):
    if s[i]=="0":
        total.append(0)
    if s[i]=="1":
        total.append(1)
    if s[i]=="B":
        if len(total)==0:
            continue
        else:
            total.pop()
total_i=""
for i in range(len(total)):
    total_i+=str(total[i])
print(total_i)

Submission status: Accepted

Solution code:
s=input()
for _ in [0]*4:
    s=s.replace("1B","")
    s=s.replace("0B","")
print(s.strip("B"))

Submission status: Accepted

Solution code:
# main関数
if __name__ == '__main__':

    s = input()
    
    ans = []
    for i in s :
        if i == 'B' :
            if len(ans) > 0 :
                ans.pop()
        else:
            ans.append(i)
    
    for i in ans :
        print(i, end="")

    print()

Submission status: Accepted

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

Submission status: Accepted

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

print ''.join(a)

Submission status: Accepted

Solution code:
s = input()

Ans = []

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = list(input())
    
    A = []
    for s in S:
        if s == "B":
            if len(A) == 0:
                pass
            else:
                A.pop()
        elif s == "0":
            A.append("0")
        elif s == "1":
            A.append("1")
    
    if len(A) == 0:
        print("")
    else:
        for x in range(len(A)):
            if x != len(A) - 1:
                print(A[x], end = "")
            else:
                print(A[x])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
words = raw_input()
inlis = list(words)
outlis = []
for item in inlis:
	if item == "0" or item == "1":
		outlis.append(item)
	elif item == "B":
		if outlis:
			outlis.pop(len(outlis)-1)
print "".join(outlis)

Submission status: Accepted

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

for i in s:
  if i == "0":
    li.append('0')
  elif i == "1":
    li.append('1')
  elif i == "B" and not len(li) == 0:
    li.pop(-1)

print("".join(li))

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
a=[]
for c in input():
	if"B"==c:a==[]or a.pop()
	else:a+=c,
print(''.join(a))

Submission status: Accepted

Solution code:
a=[]
for c in input():
 if"B"==c:a==[]or a.pop()
 else:a+=c,
print(''.join(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
INF = 10**100
r = range

class infix(object):
    def __init__(self, function):
        self.function = function

    def __ror__(self, other):
        self.left = other
        return self

    def __or__(self, other):
        return self.function(self.left, other)

    def __call__(self, value1, value2):
        return self.function(value1, value2)

@infix
def c(f_t_u, f_u_r): return lambda t: f_u_r(f_t_u(t))

class _Ap(object):
    def __rlshift__(self, other):
        self.value = other
        return self

    def __rshift__(self, other):
        return other(self.value)
Ap = _Ap()
ap = Ap

#d = {1:2, 3:5, 6:10, 1000043:3814}
#zip(d.keys(), d.values())<<ap>>(list |c| sorted |c| reversed |c| list |c| print)

s=input()
ret=[]
for c in s:
    if c == '0':
        ret.append('0')
    elif c == '1':
        ret.append('1')
    else:
        if ret<<ap>>len:
            ret.pop();

print(''.join(ret));

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""043-b"""


import sys


def main():
    """Main function."""
    s = input()

    res = ""
    for c in s:
        if c == 'B':
            res = res[:-1]
        else:
            res += c

    print(res)


if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

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

Submission status: Accepted

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

print(res)

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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    S = input()

    T = ""
    for c in S:
        if c == "B":
            T = T[:-1]
        else:
            T += c

    print(T)

if __name__ == "__main__": main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
array = []
for w in S:
    if w == "B" and len(array):
        array.pop()
    elif w != "B":
        array.append(w)
for w in array:
    print(w, end="")
print()

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !

# coding: utf-8
# Here your code !
str =""
for i in input():
    if i is '0':
        str+="0"
    elif i =='1':
        str+="1"
    else:
        str = str[:-1]
print(str)

Submission status: Accepted

Solution code:
a = raw_input()
ans = ''
for x in a:
	if x == '0':
		ans += '0'
	if x == '1':
		ans += '1'
	if x == 'B':
		if ans != '':
			ans = ans [:-1]
print(ans)

Submission status: Accepted

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

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

N=len(s)

L=[]

for i in range(N):
    if s[i]=='0':
        L.append('0')
    elif s[i]=='1':
        L.append('1')
    elif s[i]=='B':
        if L==[]:
            pass
        else:
            del L[-1]

A=''.join(L)
print(A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(raw_input())
result = []
for s in S:
	if s == "0":
		result.append(0)
	elif s == "1":
		result.append(1)
	elif s == "B":
		if len(result) != 0:
			result.pop(len(result)-1)
txt = ""
for r in result:
	txt += str(r)
print txt

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    s = input()
    ans = ""
    for c in s:
        if c in ["0", "1"]:
            ans += c
        elif c == "B" and len(ans) > 0:
            ans = ans[:len(ans) - 1]
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

ans = ""

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

Submission status: Accepted

Solution code:
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

s = rls()
ans = ["" for i in s]
idx = 0
for i in s:
    if(i == "B"):
        idx -= 1
        if(idx == -1):
            idx += 1
        else:
            ans[idx] = ""
    else:
        ans[idx] = i
        idx += 1
print(pli(ans))

Submission status: Accepted

Solution code:
# coding: utf-8

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

[print(s, end='') for s in stack]
print()

Submission status: Accepted

Solution code:
s = input()
output = []
for i in range(len(s)):
    if s[i] != 'B':
        output.append(s[i])
    else:
        if '0' in output or '1' in output:
            del output[-1]
cout = ''
for x in output:
    cout += x
print(cout)

Submission status: Accepted

Solution code:
s = list(map(str, input()))
l = len(s)
li = []
for i in range(l):
    if s[i] == "0":
        li.append(0)
    elif s[i] == "1":
        li.append(1)
    elif s[i] == "B" and li != []:
        li_len = len(li)
        li.pop(li_len-1)
ans = "".join(map(str, li))
print(ans)

Submission status: Accepted

Solution code:
S = list(input())

result = []

for s in S:
    if s in ("0", "1"):
        result.append(s)
    elif result:
        result.pop()

print("".join(result))

Submission status: Accepted

Solution code:
s = input()
sl=[]
for i in s:
    if i == "0":
        sl.append("0")
    if i == "1":
        sl.append("1")
    if i == "B":
        if sl == []:
            continue
        else:
            sl.pop()
for i in sl:
    print(i, end = "")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()

    ans = []
    for s in S:
        if s == 'B':
            try:
                ans.pop()
            except:
                pass
        else:
            ans.append(s)

    print(''.join(ans))

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(raw_input())
ans = []
for c in s:
    if (c == "0") or (c == "1"):
        ans.append(c)
    else:
        if len(ans) > 0:
            ans.pop()
print "".join(ans)

Submission status: Accepted

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

def list_n():
    return [int(e) for e in input().split()]


def list_s():
    return [s for e in input().split()]


def main(s):
    ret = []
    for c in s:
        if c in ['0', '1']:
            ret.append(c)
        else:
            if ret:
                ret.pop()
    return ''.join(ret)


if __name__ == '__main__':
    s = input()
    print(main(s))

Submission status: Accepted

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