s = (eval(input()))

ans = []

for i in s:

    if i == '0':

        ans.append(0)

    elif i == '1':

        ans.append(1)

    elif i == 'B':

        if len(ans) >= 1:

            del ans[-1]

ans = list(map(str, ans))

print((''.join(ans)))
s = list(eval(input()))

S = ''

for i in s:

    if  i == '0' or i == '1':

        S += i

    elif i == 'B' and len(S) != 0:

        S = S[:-1]

print(S)
s = eval(input())
ans = []
for i in s:
    if i == "0":
        ans.append(0)
    elif i == "1":
        ans.append(1)
    elif i == "B":
        if len(ans) >= 1:
            del ans[-1]
ans = list(map(str, ans))
print(("".join(ans)))

s = list(eval(input()))
S = ""
for i in s:
    if i == "0" or i == "1":
        S += i
    elif i == "B" and len(S) != 0:
        S = S[:-1]
print(S)

-s = eval(input()) -ans = [] +s = list(eval(input())) +S = "" -    if i == "0": -        ans.append(0) -    elif i == "1": -        ans.append(1) -    elif i == "B": -        if len(ans) >= 1: -            del ans[-1] -ans = list(map(str, ans)) -print(("".join(ans))) +    if i == "0" or i == "1": +        S += i +    elif i == "B" and len(S) != 0: +        S = S[:-1] +print(S)