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:
# -*- coding: utf-8 -*-
import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation



'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        #sqrt(n)+1以上は考えて約数はないので却下
        if n % k == 0:
            return False
            #割り切れたらFalse
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  # [1, 0, 3]

'''

def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''


########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

'''
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xaf\xb0...
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
'''
'''
引数endに任意の文字列を指定すると、その文字列が改行の代わりに最後に挿入される。例えば連続するprint()の出力を改行なしで単純に連結したい場合は空文字列''を指定すればよい。

print('abc', end='---')
print('xyz')
# abc---xyz

print('abc', end='')
print('xyz')
# abcxyz
source: print_basic.py
なお、デフォルトで改行されるのは引数endのデフォルト値が改行文字'\n'に設定されているから。
'''

def main():
    n=3
    steps=0
    state=0
    w=1
    j=0
    k=0
    #lenを変数に置くと事故るから注意
    #n=int(input())
    #a,b=input().split(" ")#a,bがともに文字列のとき
    #a,b=map(int, input().split(" "))
    #mapでとってもstrで変換すればappend可能
    s=input()
    a=[i for i in s]#int(i)にすれば数字も行ける
    n=len(s)
    c=[]
    for i in range(n):
        if a[i]=="0":
           c.append("0")
        elif a[i]=="1":
           c.append("1")
        elif a[i]==("B") and c!=[]:
           del c[-1]
    #d=str(c)
    #print(c)
    #print("".join(d))
    print("".join(c))
    #nl=list(map(int, input().split(" ")))#数字の時
    #print(a)
    #brray=[list(map(int, input().split(" ")))for i in range(N)]
    #print(brray)


    #for i in range(1,n+1,2):#これで1個飛ばしループになる
    # pass
     #print(i)

    l = ['aaa', 'bbb', 'ccc']
    x=l.index('aaa')#ある要素のインデックス番号を取得
    #s = ''.join(l)
    #s = " ".join(map(str,a))#スペースを空ける時はこう
    #print(s)
    # aaabbbccc

    #if state in known_states and not flag: # state => 2 steps => 5
        #こうやってある要素がリストの中にあるか探すのか
    #print(f'steps: {steps}, state: {state}')
    #こう書いてあるとデバックしやすい

    #dp= [[0]*3 for i in range(5)]#列　行
    #dp用の0の入ったやつ
    #dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
    #print(dp)＃初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
    DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
    exdp=np.zeros((3,4)) # ３×４の２次元配列を生成。2次元ならこう
    #dtypeは指定しないとfloatになる
    #for i in range(n):#ちょっとした入力に便利
    #    a, b = map(int, input().split())
        #dp[i][0] += [a]
        #これだとintとlistをつなぐことになって不適
    #    dp[i] += [a]
    #    dp[i] += [b]
        #これはうまくいく
        #やり方はいろいろあるということ
    #print(dp)


    #brray=[list(map(int, input().split(" ")))for i in range(N)
    #print(brray)



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]#内包表記に慣れろ
    #print(pin_l)

    ls = ["a", "b", "c", "d", "e"]


    #print(ls[2:5])
    #スライスでの取得

    #print(ls[:-3])
    #一番左端から右から3番目より左まで取得

    #print(ls[:4:2])
    #スライスで1個飛ばしで取得
    #ないときは左端スタート
    #始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
    #print(ls[::2])
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in a:
    if i=="0":
        b.append(i)
    if i=="1":
        b.append(i)
    if i=="B":
        if b!=[]:
            b.pop(-1)
for j in b:
    print(j,end="")

Submission status: Accepted

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

for s in S:
  if s == '0':
    stack.append(0)
  elif s == '1':
    stack.append(1)
  elif s == 'B':
    if stack:
      stack.pop()

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

Submission status: Accepted

Solution code:
import re
key=re.compile('[01]B')

s=input()
result=key.search(s)

while result!=None:
    s=s[0:result.start()]+s[result.end():]
    result=key.search(s)
    
while s[0]=='B':
    s=s[1:]

print(s)

Submission status: Accepted

Solution code:
s=list(input())

answer=[]
for c in s:
  if c=="B":
    if answer:
      answer.pop()
  else:
    answer.append(c)
#print(answer)

print("".join(answer))

Submission status: Accepted

Solution code:
from collections import deque
ss = input()
q = deque()
for s in ss:
    if s == "B" and len(q) > 0:
        q.pop()
    elif s == "B" and len(q) == 0:
        continue
    else:
        q.append(s)
print(''.join(q))

Submission status: Accepted

Solution code:
s=input()
l=len(s)
a=[]
for i in range(l):
  n=len(a)
  if s[i]=='0':
    a.append(0)
  elif s[i]=='1':
    a.append(1)
  elif s[i]=='B':
    if a!=[]:
      del a[n-1]
    
for i in range(len(a)):
  print(a[i],end="")

Submission status: Accepted

Solution code:
S = str(input())

ans = ''

for i in range(len(S)):
  if S[i] == '0':
    ans += '0'
  elif S[i] == '1':
    ans += '1'
  else:
    if ans == '':
      pass
    else:
      ans = ans[:-1]

print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    l=[]
    for i in s:
        if i=='0':
            l.append('0')
        elif i=='1':
            l.append('1')
        else:
            if len(l)>=1:
                l.pop(-1)
    ans=''
    for j in l:
        ans+=j
    print(ans)
resolve()

Submission status: Accepted

Solution code:
def ABC_43_B():
    s = input()
    t=[]

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

    print(''.join(t))



if __name__ == '__main__':

    ABC_43_B()

Submission status: Accepted

Solution code:
import sys
def S(): return sys.stdin.readline().rstrip()
s = S()
ans = ''
for x in s:
    if x in '01':
        ans += x
    else:
        if ans:
            ans = ans[:-1]
print(ans)

Submission status: Accepted

Solution code:
S = input()

ans = ''
for ch in S:
  if ch in ('0', '1'):
    ans += ch
  elif ch == 'B' and ans:
    ans = ans[:-1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = input()
output = []
for a in range(len(A)):
    if A[a]=="B":
        if not output==[]:
            output.pop()
    else:
        output.append(A[a])
print(*output,sep='')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import deque
def main():
    S = list(input().rstrip())
    ans = deque()
    for c in S:
        if c == "B":
            if len(ans) == 0:
                continue
            else:
                ans.pop()
        elif c == "0":
            ans.append(c)
        else :
            ans.append(c)
    print("".join(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
moji = []
for i in s:
    if i == "0":
        moji.append("0")
    elif i == "1":
        moji.append("1")
    else:
        if len(moji) != 0:

            moji.pop(len(moji)-1)
print("".join(moji))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def get_input() -> str:
    """
    標準入力の取得.

    Returns:\n
        str: 標準入力
    """
    s = input()
    return s


def main(s: str) -> None:
    """
    求解処理.\n
    順番に処理を行う.

    Args:\n
        s (str): しぐが押したキーを順番に記録した文字列
    """
    result = str()
    for s_i in s:
        if s_i == "0":
            result += "0"
        elif s_i == "1":
            result += "1"
        elif s_i == "B":
            result = result[:-1]

    # 結果出力
    print(result)


if __name__ == "__main__":
    s = get_input()
    main(s)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 標準入力の取得
s = input()

# 結果出力
result = str()
for s_i in s:
    if s_i == "0":
        result += "0"
    elif s_i == "1":
        result += "1"
    elif s_i == "B":
        result = result[:-1]

# 結果出力
print(result)

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')
    elif len(ans) > 0:
        ans.pop()
    else:
        continue
print(''.join(ans))

Submission status: Accepted

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

x = ""
for s in S:
  if x=="" and s=="B":
    continue
  if s=="B":
    x = x[:-1]
  else:
    x += s
    
print(x)

Submission status: Accepted

Solution code:
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    s = inputStrOnebyOne()
    ret = []
    for i in range(len(s)):
        if s[i] == "0":
            ret.append(s[i])
        elif s[i] == "1":
            ret.append(s[i])
        else:
            if 1<=len(ret):
                ret.pop()
    print(''.join(ret))

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

ret = ""
for i in S:
    if i == "B":
        ret = ret[:-1]
    else:
        ret += i

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
res = []
for s in S:
    if s=='0':
        res.append('0')
    elif s=='1':
        res.append('1')
    else:
        if res:
            res = res[:-1]
print(''.join(res))

Submission status: Accepted

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

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

print("".join(res))

Submission status: Accepted

Solution code:
s = str(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:
            continue
        else:
            ans = ans[:-1]
print(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":
        if len(ans) == 0:
            continue
        else:
            ans = ans[:-1]
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = str(input())
    result = ""

    for c in N:
        if c == '0':
            result = result + '0'
        elif c == '1':
            result = result + '1'
        elif c == 'B':
            result = result[0:len(result)-1]
    
    print(result)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s_list = list(map(str, input().rstrip()))

ans = []

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

Submission status: Accepted

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

Submission status: Accepted

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

print("".join(l))

Submission status: Accepted

Solution code:
S = input()
cha = list(S)
plist = []

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

print(plist)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = []

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

print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    ans = ''
    for char in s:
        if char == 'B':
            ans = ans[:-1] if ans else ''
        else:
            ans += char

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    qu = []

    for s in S:
        if len(qu) > 0 and s == 'B':
            qu.pop()
        elif s != 'B':
            qu.append(s)
    print(''.join(qu))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(input())
mojiretu = ''
for idx, ji in enumerate(s):
    if ji == 'B':
        mojiretu = mojiretu[:-1]
    else:
        mojiretu += ji
print(mojiretu)

Submission status: Accepted

Solution code:
S=input()

ans=''
for i in S:
    if i=='0':
        ans+='0'
    elif i=='1':
        ans+='1'
    else:
        if len(ans)>=2:
            ans=ans[:len(ans)-1]
        else:
            ans=''

print(ans)

Submission status: Accepted

Solution code:
def main():
  num = input()
  ans=""
  for i in range(0,len(num)):
    if num[i]=='B':
      ans=ans[:-1]
    else:
      ans += num[i]
  print(ans)

main()

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)!=0:
            a.pop()
    
print("".join(a))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
s=str(input())
s=list(s)
temp=[]
i=0
for i in range(0,len(s)):
  if s[i]=="1":
    temp.insert(0,"1")
  elif s[i]=="0":
    temp.insert(0,"0")
  else:
    if len(temp)!=0:
      del temp[0]
temp.reverse()
temp="".join(temp)
print(temp)

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 += s[i]
        
print("".join(a))

Submission status: Accepted

Solution code:
s = input()

ans = []
for i in s:
    if i == '0':
        ans.append(i)
    elif i == '1':
        ans.append(i)
    elif i == 'B':
        if len(ans) != 0:
            # ans.remove(ans[-1])
            ans = ans[0:len(ans)-1]
print("".join(ans))

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()
ans = ''
for c in s:
    if c in {'0', '1'}:
        ans += c
    if c == 'B':
        if len(ans) != 0:
            ans = ans[:-1]
print(ans)

Submission status: Accepted

Solution code:
str_list=[]
tmp=[]
s=''
str_list=list(input())
for i in str_list:
    if i =='0':
        tmp.append('0')
    elif i == '1':
        tmp.append('1')
    elif i == 'B' and tmp:
        tmp.pop()
for i in range(len(tmp)):
    s+=tmp[i]
print(s)

Submission status: Accepted

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

for i in s:
    if i == '0' or i == '1':
        ans += i
    else:
        if len(ans) >= 1:
            ans = ans[:-1]

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

def S(): return stdin.readline().rstrip()
def I(): return int(stdin.readline().rstrip())
def LS(): return list(stdin.readline().rstrip().split())
def LI(): return list(map(int,stdin.readline().rstrip().split()))

s = S()

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

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


# ===CODE===
def main():
    s = list(sys.stdin.readline())
    d = []

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

    print(*d, sep="")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
ss = input()

ans = ""
for s in ss:
    if s == "0":
        ans += "0"
    elif s == "1":
        ans += "1"
    else:
        ans = ans[0:-1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def cin():
	return map(int,input().split())

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))

a = cino(True)
a = list(a)
s = []
for i in a:
    if i=='B' and len(s)>0:
        s.pop()
    elif i=='0' or i=='1':
        s.append(i)

print(''.join(s))

Submission status: Accepted

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