S = input()

ans = []



for s in S:

    if s == 'B' and ans:

        ans.pop()

    elif s != 'B':

        ans.append(s)



print(*ans, sep='')

import sys

stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

from collections import deque



i_i = lambda: int(i_s())

i_l = lambda: list(map(int, stdin.readline().split()))

i_s = lambda: stdin.readline().rstrip()



s = i_s()

d = deque()



for x in s:

    if d and x == 'B':

        d.pop()

    elif x == '0' or x == '1':

        d.append(x)



print(*d, sep='')

S = input()
ans = []
for s in S:
    if s == "B" and ans:
        ans.pop()
    elif s != "B":
        ans.append(s)
print(*ans, sep="")

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**7)
from collections import deque

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
s = i_s()
d = deque()
for x in s:
    if d and x == "B":
        d.pop()
    elif x == "0" or x == "1":
        d.append(x)
print(*d, sep="")

-S = input() -ans = [] -for s in S: -    if s == "B" and ans: -        ans.pop() -    elif s != "B": -        ans.append(s) -print(*ans, sep="") +import sys + +stdin = sys.stdin +sys.setrecursionlimit(10**7) +from collections import deque + +i_i = lambda: int(i_s()) +i_l = lambda: list(map(int, stdin.readline().split())) +i_s = lambda: stdin.readline().rstrip() +s = i_s() +d = deque() +for x in s: +    if d and x == "B": +        d.pop() +    elif x == "0" or x == "1": +        d.append(x) +print(*d, sep="")