s = eval(input())

ans = ''

for c in s:

    if c == '0':

        ans += '0'

    elif c == '1':

        ans += '1'

    else:

        ans = ans[:-1]

print(ans)
s = eval(input())

ans = ''

for c in s:

    if c == '0':

        ans += '0'

    elif c == '1':

        ans += '1'

    elif c == 'B' and ans:

        ans = ans[:-1]

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

s = eval(input())
ans = ""
for c in s:
    if c == "0":
        ans += "0"
    elif c == "1":
        ans += "1"
    elif c == "B" and ans:
        ans = ans[:-1]
print(ans)

-    else: +    elif c == "B" and ans: