s=eval(input())

t=""

for i in range(len(s)):

    if s[i]=='B':

        if t!="":

            t=t[:len(t)-1]

    else:

        t+=s[i]

print(t)

s=input()

t=[]

for i in s:

    if i=="0":

        t.append(0)

    elif i=="1":

        t.append(1)

    else:

        if len(t)>0:

            t.pop(-1)

print(*t,sep="")

s = eval(input())
t = ""
for i in range(len(s)):
    if s[i] == "B":
        if t != "":
            t = t[: len(t) - 1]
    else:
        t += s[i]
print(t)

s = input()
t = []
for i in s:
    if i == "0":
        t.append(0)
    elif i == "1":
        t.append(1)
    else:
        if len(t) > 0:
            t.pop(-1)
print(*t, sep="")

-s = eval(input()) -t = "" -for i in range(len(s)): -    if s[i] == "B": -        if t != "": -            t = t[: len(t) - 1] +s = input() +t = [] +for i in s: +    if i == "0": +        t.append(0) +    elif i == "1": +        t.append(1) -        t += s[i] -print(t) +        if len(t) > 0: +            t.pop(-1) +print(*t, sep="")