# -*- coding: utf-8 -*-

s = list(eval(input()))



ans = []

for i in range(len(s)):

    if s[i] == '0':

        ans.append('0')

    if s[i] == '1':

        ans.append('1')

    if len(ans) >= 1 and s[i] == 'B':

        ans.pop()

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

# -*- coding: utf-8 -*-

s = list(eval(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)))

# -*- coding: utf-8 -*-
s = list(eval(input()))
ans = []
for i in range(len(s)):
    if s[i] == "0":
        ans.append("0")
    if s[i] == "1":
        ans.append("1")
    if len(ans) >= 1 and s[i] == "B":
        ans.pop()
print(("".join(ans)))

# -*- coding: utf-8 -*-
s = list(eval(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)))

-for i in range(len(s)): -    if s[i] == "0": +for i in s: +    if len(ans) > 0 and i == "B": +        ans.pop() +    if i == "0": -    if s[i] == "1": +    if i == "1": -    if len(ans) >= 1 and s[i] == "B": -        ans.pop()