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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
st = []
for e in s:
  if e == 'B' and len(st) != 0:
    st.pop()
  else:
    st.append(int(e))
print(''.join(map(str,st)))

Submission status: Runtime Error

Solution code:
s = input()
st = []
for e in s:
  if e == B and len(st) != 0:
    st.pop()
  else:
    st.append(int(e))
print(''.join(map(str,st)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
list_s=list(s)
element='B'
l1=['0','1','B']
for i in range(0,len(list_s)-1):
	if(list_s[i] == element):
		index_element=list_s[i-1]
		if(index_element):
			list_s.remove(index_element)
			list_s.remove(element)
			print(list_s)
		else:
		    list_s.append("s")
		    list_s.remove("s")

	else:
		list_s.append("s")
		list_s.remove("s")
		print(list_s)

list_s.remove('B')
print(list_s)

Submission status: Runtime Error

Solution code:
s=input()
list_s=list(s)
element='B'
l1=['0','1','B']
for i in range(0,len(list_s)):
	if(list_s[i] == element):
		index_element=list_s[i-1]
		if(index_element):
			list_s.remove(index_element)
			list_s.remove(element)
			print(list_s)
		else:
		    list_s.append("s")
		    list_s.remove("s")

	else:
		list_s.append("s")
		list_s.remove("s")
		print(list_s)

list_s.remove('B')
print(list_s)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
a = []
for i in range(n):
  if i =="0":
    a.append("0")
  elif i =="1":
    a.append("1")
  elif i =="B":
    a.pop()
print(*a)

Submission status: Runtime Error

Solution code:
n = input()
a = ""
for i in range(n):
  if i =="0":
    a.append(0)
  elif i =="1":
    a.append(1)
  elif i =="B":
    a.pop()
print(a)

Submission status: Runtime Error

Solution code:
S = input()

a = ''
count = 0
for s in S:
    if s == '0':
        a +='0'
    if s == '1':
        a +='1'
    if s == 'B':
        if a != '':
            a = a.rstrip(a[count-1],1)
        if a == '':
            continue
    count +=1

print(a)

Submission status: Runtime Error

Solution code:
S = input()

a = ''
count = 0
for s in S:
    if s == '0':
        a +='0'
    if s == '1':
        a +='1'
    if s == 'B':
        if a != '':
            a = a.rstrip(a[count-1])
        if a == '':
            continue
    count +=1

print(a)

Submission status: Runtime Error

Solution code:
import math
from math import gcd,pi
INF = float("inf")
 
import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

S = s_input()

a = ''
count = 0
for s in S:
    if s == '0':
        a +='0'
    if s == '1':
        a +='1'
    if s == 'B':
        if a != '':
            a = a.rstrip(a[count-1])
        if a == '':
            continue
    count +=1

print(a)

Submission status: Runtime Error

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

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

print(''.join(a))

Submission status: Runtime Error

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

if a==0:
    s.append(0)
elif a==1:
    s.append(1)
else:
    if len(s)>0:
        s.pop()
        
for l in s:
    print(l)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

        
print(''.join(ans))

Submission status: Runtime Error

Solution code:
import re
text = input()
b_length = int(re.sub('[^B]', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)

Submission status: Runtime Error

Solution code:
import re
text = input()
b_length = re.sub('B', '', text)
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)

Submission status: Runtime Error

Solution code:
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r

def check(n,s):
    v=str(n)
    for i in v:
        if i in s:
            return False
    return True
    

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

for _ in range(1):
    solve()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
k=int(input("enter keys="))
b=" "
length=len(s)
while length <=1 or length<=0:
  if k==0 and k==1 and k==b:
    print(s)
  elif k==0:
    print(s=0)
  elif k==1:
    print(s=1)
  else:
    print(s=b)

Submission status: Runtime Error

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

ans = []
for i in range(n):
    if s[i] == '0':
        ans.append('0')
    if s[i] == '1':
        ans.append('1')
    if s[i] == 'B':
        ans[-1] = ''

print("".join(ans))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# B - バイナリハックイージー

s = input()
listAns = []

set1 = ['0', '1']
set2 = ['B']

listS = list(s)

print(listS)

for i in listS:
    if i in set1:
        listAns.append(i)

    elif i in set2:
        if len(listAns) != 0:
            listAns.pop()

ans = reduce(lambda x, y: x + y, [str(x) for x in listAns])

print(ans)

Submission status: Runtime Error

Solution code:
lst=[]
res=[]
a=input()
for i in range(len(a)):
    lst.append(a[i])
    if lst[i] == "0":
        res.append(lst[i])
    elif lst[i] == "1":
        res.append(lst[i])
    else:
        if res == [] or res[0] == "" :
            continue
        else:
            res.remove(lst[len(res)-1])
print("".join(res))

Submission status: Runtime Error

Solution code:
lst=[]
res=[]
a=input()
for i in range(len(a)):
    lst.append(a[i])
    if lst[i] == "0":
        res.append(lst[i])
    elif lst[i] == "1":
        res.append(lst[i])
    else:
        if res == [] or res[0] == "" :
            
        else:
            res.remove(lst[len(res)-1])
print("".join(res))

Submission status: Runtime Error

Solution code:
lst=[]
res=[]
a=input()
for i in range(len(a)):
    lst.append(a[i])
    if lst[i] == "0":
        res.append(lst[i])
    elif lst[i] == "1":
        res.append(lst[i])
    else:
        if res==[]:
            pass
        else:
            res.remove(lst[len(res)-1])
print("".join(res))

Submission status: Runtime Error

Solution code:
lst=[]
res=[]
a=input()
for i in range(len(a)):
    lst.append(a[i])
    if lst[i] == "0":
        res.append(lst[i])
    elif lst[i] == "1":
        res.append(lst[i])
    else:
        if len(res)==0:
            continue
        else:
            res.remove(lst[len(res)-1])
print("".join(res))

Submission status: Runtime Error

Solution code:
n = input()
s = " "
for i in n:
    if i == '0':
        s+='0'
    elif i=='1':
        s+='1'
    if i=='B':
        s = s.replace(s[-1],'')

print(s)

Submission status: Runtime Error

Solution code:
s=input()

ans=''
for x in s:
  if ans<>'':
    if x=='B'
      ans=ans[:-1]
      continue
  if x<>'B':
    ans+=x
print(ans)

Submission status: Runtime Error

Solution code:
arr = input()
arr = ''.join(reversed(arr))
print(arr[:arr.index('B')])

Submission status: Runtime Error

Solution code:
def key():
    a=input()
    b=input()
    c=input()
    d=input()
    key=[a,b,c,d]
    if key[0]=='b':
        print('')
    elif key[0]=='0':
        print('0')
    else:
        print('1')
    if key[1]=='b':
        key.pop()
    elif key[1]=='0':
        print('0')
    else:
        print('1')
    if key[2]=='b':
        key.pop()
    elif key[2]=='0':
        print('0')
    else:
        print('1')
    if key[3]=='b':
        key.pop()
    elif key[3]=='0':
        print('0')
    else:
        print('1')

key()

Submission status: Runtime Error

Solution code:
#入力
input = input()

lst = []
text = ''

#操作
for i in range(len(input)):
   if input[i] == '0':
      text = text + '0'
   elif input[i] == '1':
      text = text + '1'
   elif input[i] = 'B':
      if text != '': #文字列が空でないときのみBS実行
         text = text[:-1]

#出力
print(text)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
from fractions import gcd
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) # tupleも検討する。
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = S()
    L = [i for i in N]

    for i, num in enumerate(L):
        if(i != 0 and num == "B"):
            L[i-1] = ""

    L.remove("B")
    print("".join(L))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	string s, ans="";
	cin >> s;
	for(auto x : s){
		if(x!='B') ans+=x;
		else if(ans!="") ans.pop_back();
	}
	cout << ans << endl;
 	return 0;
}

Submission status: Runtime Error

Solution code:
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[i-1]
        
print("".join(b))

Submission status: Runtime Error

Solution code:
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if a[0] == str("B"):
            pass
        else:
            del b[i-1]
        
print("".join(b))

Submission status: Runtime Error

Solution code:
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    else:
        del b[i-1]
print("".join(b))

Submission status: Runtime Error

Solution code:
def sig():
    key=[input()]   q
    a=key[0]
    if a =='0':
       key.append('0')
    elif a=='1':
       key.append('1')
    else:
       key.append('')
    for i in key:
        b=key[i]
        if b =='0':
           key.append('0')
        elif b=='1':   
           key.append('1')
        else:
            key.pop(i-1)

    print(key)

sig()

Submission status: Runtime Error

Solution code:
s=input()
b=False
result = []
for i in s:
  if i=='B':
    if not b:
      result.pop()
      b=True
  else:
    b=False
    result.append(i)
print(''.join(result))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

for c in s:
  if c == 'B' && len(txt) > 0:
    txt.pop()
  elif:
    txt.append(c)
    
print(''.join(txt))

Submission status: Runtime Error

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

ans=[]
for i in s:
  if i=='1':
    ans.append('1')
  elif i=='0':
    ans.append(0,'0')
  else:
    if ans:
      ans.pop(-1)
    else:
      continue

print(''.join(ans))

Submission status: Runtime Error

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

ans=[]
for i in s:
  if i=='1':
    ans.append('1')
  elif i=='0':
    ans.insert(0,'0')
  else:
    ans.pop(-1)

print(''.join(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(ANS)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
moji = []
ans=""
s = str(input())
s = list(s)

def keyboard(key,list):
    if key == "0":
        list.append("0")
    elif key == "1":
        list.append("1")
    elif key == "B":
        list.pop(-1)

for i in range(len(s)):
    keyboard(s[i],moji)

for x in moji:
    ans += x

print(ans)

Submission status: Runtime Error

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

S = str(input())

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

print(w)

Submission status: Runtime Error

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

S = str(input())

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

print(w)

Submission status: Runtime Error

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

S = str(input())

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

print(w)

Submission status: Runtime Error

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

S = str(input())

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

print(w)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
n=len(s)
a=[]
b=""
for i in range(s):
  if s[i]=="B":
    a.pop()
  else:
    a.append(s[i])
for i in range(len(a)):
  b+=a[i]
print(b)

Submission status: Runtime Error

Solution code:
S=input()

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

print("".join(result))

Submission status: Runtime Error

Solution code:
a = input()
ans = ""
for i in range(len(a)):
    if a[i] == 'B' or (i + 1 < len(a) and a[i + 1] == 'B'):
        continue
    else:
        ans = ans + a[i]

print(ans)

Submission status: Runtime Error

Solution code:
a = input()
ans = ""
for i in range(len(a)):
    if i + 1 < len(a) and a[i + 1] == 'B' or a[i] == 'B':
        continue
    else:
        ans = ans + a[i]

print(ans)

Submission status: Runtime Error

Solution code:
li = list(input())
line = []

for i in li:
  if i == "0":
    line.append("0")
  elif i == "1":
    line.append("1")
  else:
    line.pop(len(line) - 1)

print("".join(line))

Submission status: Runtime Error

Solution code:
s = input()
s_list = []
input_list = []

for i in range(len(s)):
    s_list.append(s[i])

for i2 in range(len(s)):
    if s_list[i2] == "0":
        input_list.append("0")
    elif s_list[i2] == "1":
        input_list.append("1")
    elif s_list[i2] == "B" and input_list != 0:
        input_list.pop(-1)
    else:
        pass

for i3 in range(len(input_list)):
    print(input_list[i3],end="")

Submission status: Runtime Error

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"):
           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: Runtime Error

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[i-1]

    print(''.join(t))



if __name__ == '__main__':

    ABC_43_B()

Submission status: Runtime Error

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

if __name__=='__main__':
    main()

Submission status: Runtime Error

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

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

plist = "".join(plist)

print(plist)

Submission status: Runtime Error

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7

s = input()
q = [""]
for i in range(len(s)):
    if s[i] == "0":
        q.append(0)
    elif s[i] == "1":
        q.append(1)
    else:
        q.pop()
ans = ""
for i in range(len(q)):
    ans += str(q[i])
print(ans)

Submission status: Runtime Error

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7

s = input()
q = []
for i in range(len(s)):
    if s[i] == "0":
        q.append(0)
    elif s[i] == "1":
        q.append(1)
    else:
        q.pop()
ans = ""
for i in range(len(q)):
    ans += str(q[i])
print(ans)

Submission status: Runtime Error

Solution code:
s = input()
l = len(s)
t=[]
for i in range(l):
    c = s[i]
    if c=='B':
        if len(t)==0:
            continue
        else:
            t.remove(t[len-1])
    else:
        t.append(c)
print(t)