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

s = []
for each in S:
    if each == 'B':
        if len(s) > 0:
            s.pop()
    else:
        s.append(each)
print(''.join(s))

Submission status: Accepted

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

for s in S:
    if s == 'B' and Answer != []:
        del Answer[-1]
    elif s == 'B' and Answer == []:
        continue
    else:
        Answer.append(s)

print(*Answer, sep="")

Submission status: Accepted

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

for s in S:
  if s=="B":
    if a:
      a.pop()
  else:
    a.append(s)

print(*a,sep="")

Submission status: Accepted

Solution code:
# ABC 043: B – バイナリハックイージー / Unhappy Hacking (ABC Edit)
s = input()
editor = ''
for c in s:
    if c == '0':
        editor += '0'
    elif c == '1':
        editor += '1'
    elif c == 'B':
        if len(editor) > 0:
            editor = editor[:-1]
print(editor)

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import numpy as np
import collections

#n = int(input())
#n, l = list(map(int, input().split()))
#a = list(map(int, input().split()))
s = input()
ans = ""
for i in range(len(s)):
    if s[i]=="0":
        ans += "0"
    elif s[i]=="1":
        ans += "1"
    else:
        if ans!="":
            ans = ans[0:-1]

print(ans)

Submission status: Accepted

Solution code:
s = 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:
S = input()
ans = []
for s in S:
    if s == 'B':
        if len(ans) >= 1:
            ans.pop()
        else:
            continue
    else:
        ans.append(s)

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

for i in s:
    if i == "1":
        k += "1"
    elif i == "0":
        k += "0"
    else:
        _len = len(k)
        k = k[:_len-1]

print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
from collections import deque

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

s = i_s()
d = deque()

for x in s:
    if d and x == 'B':
        d.pop()
    elif x == '0' or x == '1':
        d.append(x)

print(*d, sep='')

Submission status: Accepted

Solution code:
s=input()
length = len(s)
ary = []

for i in range(length):
  if s[i] != "B":
    ary.append(s[i])
  elif len(ary) != 0:
    ary.pop(-1)
    
print("".join(ary))

Submission status: Accepted

Solution code:
def solve(str):
  ans = ""
  for s in str:
    if s == '0':
      ans += '0'
    elif s == '1':
      ans += '1'
    elif s == 'B':
      if len(ans) == 0:
        continue
      else:
        ans = ans[:-1]
    else:
      RuntimeError("input is not 0 or 1 or B.")
      return
  return ans

if __name__ == "__main__":
  s = input()
  ans = solve(s)
  print(ans)

Submission status: Accepted

Solution code:
s = list(input())

ans = []

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

print("".join(ans))

Submission status: Accepted

Solution code:
key=list(input())

text=[]

while len(key)>0:
  t = key.pop(0)
  if t=='B' and len(text)<=0:
    pass
  elif t=='B' and len(text)>0:
    text.pop()
  elif t=='0':
    text.append('0')
  elif t=='1':
    text.append('1')
    
print(''.join(text))

Submission status: Accepted

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

for i in range(len(s)):
    if s[i] == '0' or s[i] == '1':
        ans.append(s[i])
    else:
        if ans:
            _ = ans.pop()


print(''.join(ans))

Submission status: Accepted

Solution code:
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# library
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------
from collections import deque

S = input().rstrip()
d = deque()

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

print("".join(d))

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"
    elif s[i] == "B":
        ans = ans[:-1]
print(ans)

Submission status: Accepted

Solution code:
s = list(input())

from collections import deque
ans = deque([])
for i in range(len(s)):
    if s[i] == 'B':
        if ans:
            ans.pop()
    else:
        ans.append(s[i])

print(''.join([str(i) for i in ans]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

S=input()
d=deque()
for s in S:
  if s == 'B':
    if len(d) != 0:
      d.pop()
  else:
    d.append(s)
print(''.join(d))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
url = "https://atcoder.jp/contests/abc043/tasks/abc043_b"

def main():

    a = input()
    a = list(a)

    ans = []

    for v in a:
        if v == "B":
            if len(ans) == 0:
                pass
            else:
                ans.pop(-1)
        else:
            ans.append(v)
    print(''.join(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
L = len(s)

result = ""

for i in range(0, L):
  if s[i] == "0":
    result = result + "0"
  elif s[i] == "1":
    result = result + "1"
  else:
    if result == "":
      pass
    else:
      result = result[:-1]

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
res=[]
for i in s:
    if i=="B":
        res=res[:-1]
    else:
        res.append(i)
print("".join(res))

Submission status: Accepted

Solution code:
s = input()
ans = ["0"]*len(s)
j = 0
for i in range(len(s)):
    if s[i] == "B":
        j -=1
        if j<0:
            j = 0
    else:
        ans[j]=s[i]
        j+=1
print("".join(ans[:j]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7
def main():
  s = input()
  ans = ""
  for a in s:
    if a == '0':
      ans+=a
    elif a == '1':
      ans+=a
    elif a == 'B':
      ans = ans[0:len(ans)-1]
  print(ans)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = input()
li2 =[]
for n in li:
    if n == "0":
        li2.append("0")
    elif n == "1":
        li2.append("1")
    elif n == "B":
        if not len(li2) == 0:
            li2.pop()
print("".join(li2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(input())
A=[]
for s in S:
	if s=='B':
		if len(A)>0: del A[-1]
	else: A.append(s)
print("".join(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
S = list(input())
T = list()

for i in range(len(S)):
  if S[i] == "B":
    if len(T) == 0:
      pass
    else:
      T.pop(-1)
  else:
    T = T + list(S[i])
print(''.join(T))

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = input()
    ans = ""
    for i in s:
        if i == "0":
            ans += "0"
        if i == "1":
            ans += "1"
        if i == "B":
            if ans =="":
                ans =ans
            else:
               ans =ans[:len(ans)-1]
    print(ans)

Submission status: Accepted

Solution code:
s = list(map(str,input()))

ans = []

for i in range(len(s)):
    if s[i] == '0':
        ans.append('0')
    elif s[i] == '1':
        ans.append('1')
    else:
        if ans == []:
            continue
        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'
    elif s[i]=='B' and len(s)!=0:
        ans=ans[:-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
s=[str(c) for c in(S)]
size=0
a=[]
for i in (s):
  if i=='1' or i=='0':
    a.append(i)
    size+=1
  else:
    if size!=0:
      a.pop(size-1)
      size-=1
for j in range(size):
  print(a[j],end="")

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s=input()
output=""
for n in range(0,len(s)):
    if s[n]=="0":
        output+="0"
    elif s[n]=="1":
        output+="1"
    elif s[n]=="B":
        if len(output)>=1:
            output=output[:len(output)-1]
print(output)

Submission status: Accepted

Solution code:
lista = list(input())
listb=[]
for a in lista:
    if a == "0" or a =="1":
        listb.append(a)
    elif a =="B":
        if len(listb)>0:
            listb.pop()
print(''.join(listb))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc043/tasks/abc043_b
s = list(input())
result = []
for c in s:
    if c == 'B':
        if len(result) > 0:
            result.pop()
    else:
        result.append(c)

print(''.join(result))

Submission status: Accepted

Solution code:
s=input()
#s='0BB1'
l=[]
for i in s:
    if i=='0':
        l.append(0)
    elif i=='1':
        l.append(1)
    else:
        if len(l)==0:
            pass
        else:
            del l[-1]
print(*l,sep='')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
a = []
for l in s:
	if l == '0':
		a.append('0')
	if l == '1':
		a.append('1')
	if l == 'B' and len(a) != 0:
		a.pop()
		
print(''.join(a)) if len(a) > 0 else print('')

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(s: str):
    ans = []
    for c in s:
        if c == "B":
            if len(ans) > 0:
                ans.pop()
        else:
            ans.append(c)
    if len(ans) == 0:
        print("error")
    else:
        print("".join(ans))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    solve(s)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
_input = list(input())
_output = ""


for i in _input:
    if i == "B":
        if len(_output) > 0:
            _output = _output[0:-1]
    else:
        _output += i

print(_output)

Submission status: Accepted

Solution code:
s=input()
ans=[]
for i in s:
	if i!="B":
		ans.append(i)
	else:
		try:
			ans.pop(-1)
		except:
			pass
for i in ans:
	print(i,end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str = input()
len_str = len(str)
result = ''
for i in str:
    if i != 'B':
        result = ''.join([result, i])
    elif len(result) > 0:
        result = result[:-1]

print(result)

Submission status: Accepted

Solution code:
"""
kari1 = '01B0' #00
kari1 = '0BB1' #1
in1 = kari1
"""
in1 = input()

RC = ''
for idx1 in range(len(in1)):
    if in1[idx1] == '0':
        RC = RC + '0'
    elif in1[idx1] == '1':
        RC = RC + '1'
    elif in1[idx1] == 'B':
        if RC != '':
            RC = RC[0:len(RC) - 1]

print(RC)

Submission status: Accepted

Solution code:
s = list(input())

ans = ""

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

Submission status: Accepted

Solution code:
s = input()

def put_key(x,ans):
  if x =="0":
    return ans + "0"
  elif x== "1":
    return ans + "1"
  else:
    ls = list(ans)
    if len(ls) == 0:
      return ans
    else:
      ls[-1] = ""
      return  "".join(ls)

ans =str("")
for t in range(len(s)):
  ans = put_key(s[t],ans)
print(ans)

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key



__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    S = input()

    stk = Stack()
    # ret, i = '', 0
    # while i < len(S):
    #     if S[i] == 'B':
    #         if i <= 1:
    #             ret = ''
    #         else:
    #             ret = ret[:i-1] + ret[i+1:]
    #     else:
    #         ret += S[i]
    #     i += 1
    for s in S:
        if s == 'B':
            if stk.empty():
                pass
            else:
                stk.get()
        else:
            stk.put(s)

    ret = ''
    while not stk.empty():
        ret += stk.get()
    # 出力
    print(ret[::-1])



# EOF

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=input()
x=list(x)
y=[]
for i in range(len(x)):
	if x[i]=='B':
		if len(y)!=0:
			del y[-1]
	else:
		y.append(x[i])
print(*y,sep='')

Submission status: Accepted

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

def main():
    S = input().strip()


    ans = []
    for s in S:
        if s == 'B':
            if len(ans) > 0:
                ans.pop()
        else:
            ans.append(s)

    print("".join(ans))




if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
 
counter = 0
moji = ""
for i in s:
	
	if i == "B":
		moji = moji[:-1]
		
		continue
    	

	moji = moji+ i

print(moji)

Submission status: Accepted

Solution code:
S = input()
ans = ""
for e in S:
    if e == "0":
        ans += "0"
    elif e == "1":
        ans += "1"
    else:
        if len(ans) > 0:
            ans = ans[:-1]
print(ans)

Submission status: Accepted

Solution code:
from collections import deque

s = input()

res = deque()
for i in s:
    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 = input()
n = len(s)
ans = ''
for i in range(n):
    if s[i] == '0':
        ans +='0'
    elif s[i] == '1':
        ans+= '1'
    else:
        if len(ans)>0:
            ans = ans[:len(ans)-1]
        else:
            continue
print(ans)

Submission status: Accepted

Solution code:
stack =[]

s = input()

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


print("".join(stack))

Submission status: Accepted

Solution code:
s=list(input())
from collections import deque
d=deque()
for i in s:
    if i=="0":
        d.append(i)
    elif i=="1":
        d.append(i)
    else:
        if len(d)>0:
            d.pop()
print(''.join(list(d)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    s = input().strip("\n")
    q = deque()
    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()
    print("".join(map(str, q)))

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s = list(ns())
ans = ''
from collections import deque
d=[]

for i in s:
    if i == '0':
        d.append('0')
    elif i == '1':
        d.append('1')
    elif i == 'B' and len(d) > 0:
        d.pop()

print(''.join(d))

Submission status: Accepted

Solution code:
S = input()
ans = []
for s in S:
    if s == "0":
        ans.append(0)
    elif s == "1":
        ans.append(1)
    else:
        if ans:
            ans.pop(-1)
print(*ans, sep='')

Submission status: Accepted

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

for i in s:
    if i=="0" or i=="1":
        ans.append(i)
    else:
        ans=ans[:len(ans)-1]
print(''.join(ans))

Submission status: Accepted

Solution code:
# Problem B - バイナリックイージー
# input
s = list(input())

# initialization
result = []

# count
for c in s:
    if c=='B':
        if len(result)>0:
            result.pop(-1)
    elif c=='0':
        result.append(c)
    elif c=='1':
        result.append(c)

# output
print("".join(result))

Submission status: Accepted

Solution code:
S = list(input())
ret = [-1] * 100
for s in S:
    if s == "B":
        ret.pop()
    elif s == "0":
        ret.append(0)
    else:
        ret.append(1)

print(''.join(str(i) if i >= 0 else '' for i in ret))

Submission status: Accepted

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

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: continue
    ans.pop(-1)
print("".join(ans))

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

Submission status: Accepted

Solution code:
S = list(input())

ans = ['']*11
index = 0
for s in S:
    if s != 'B':
        ans[index] = s
        index += 1
    elif index >= 1:
        index -= 1
        ans[index] = ''
print(''.join(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:
from collections import deque
S = input()

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

s = input().rstrip()
ans = [] 
for ch in s:
    if ch in "01":
        ans.append(ch)
    if ch == "B" and ans:
        ans.pop()
print("".join([item for item in ans]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:

n = input()
 
res = []
 
for char in n:
    if char == '0':
        res.append(char)
    elif char == '1':
        res.append(char)
    elif char == 'B':
        if len(res) > 0:
            res.pop()
 
print(''.join(res))

Submission status: Accepted

Solution code:
n = input()

res = []

for char in n:
    if char == '0':
        res.append(char)
    elif char == '1':
        res.append(char)
    elif char == 'B':
        if len(res) > 0:
            res.pop()

print(''.join(res))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lis = list(input())

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

print("".join(ans))

Submission status: Accepted

Solution code:
s = input()

p = []

for token in list(s):
    if token == "B":
        if not len(p) == 0:
            p.pop()
    else:
        p.append(token)

print("".join(p))

Submission status: Accepted

Solution code:
from collections import deque
s = input()
d = deque()
for i in s:
    if i == 'B' and len(d) > 0:
        _ = d.pop()
    if i != 'B':
        d.append(i)
print(''.join(d))