s=list(eval(input()))

ans=[]

for i in s:

    if i=='B' :

        if ans: ans.pop()

    else:ans.append(i)

print((''.join(ans)))
# https://atcoder.jp/contests/abc043/tasks/abc043_b



s=input()



res=[]

for e in s:

    if e=='B':

        if res:

            res.pop()

        else:continue

    else:

        res.append(e)

print(*res,sep='')

s = list(eval(input()))
ans = []
for i in s:
    if i == "B":
        if ans:
            ans.pop()
    else:
        ans.append(i)
print(("".join(ans)))

# https://atcoder.jp/contests/abc043/tasks/abc043_b
s = input()
res = []
for e in s:
    if e == "B":
        if res:
            res.pop()
        else:
            continue
    else:
        res.append(e)
print(*res, sep="")

-s = list(eval(input())) -ans = [] -for i in s: -    if i == "B": -        if ans: -            ans.pop() +# https://atcoder.jp/contests/abc043/tasks/abc043_b +s = input() +res = [] +for e in s: +    if e == "B": +        if res: +            res.pop() +        else: +            continue -        ans.append(i) -print(("".join(ans))) +        res.append(e) +print(*res, sep="")