a = list(eval(input()))

b = []



for i in range(len(a)):

  if a[i] == "0":

    b.append("0")

  elif a[i] == "1":

    b.append("1")

  elif a[i] == "B" and len(b) != 0:

    b.pop()

  else:

    continue

    

print(("".join(b)))
moji = list(eval(input()))

ans = []



for i in moji:

  if i == "0":

    ans.append("0")

  elif i == "1":

    ans.append("1")

  else:

    if len(ans) != 0:

      ans.pop()

    else:

      continue

    

print(("".join(ans)))
a = list(eval(input()))
b = []
for i in range(len(a)):
    if a[i] == "0":
        b.append("0")
    elif a[i] == "1":
        b.append("1")
    elif a[i] == "B" and len(b) != 0:
        b.pop()
    else:
        continue
print(("".join(b)))

moji = list(eval(input()))
ans = []
for i in moji:
    if i == "0":
        ans.append("0")
    elif i == "1":
        ans.append("1")
    else:
        if len(ans) != 0:
            ans.pop()
        else:
            continue
print(("".join(ans)))

-a = list(eval(input())) -b = [] -for i in range(len(a)): -    if a[i] == "0": -        b.append("0") -    elif a[i] == "1": -        b.append("1") -    elif a[i] == "B" and len(b) != 0: -        b.pop() +moji = list(eval(input())) +ans = [] +for i in moji: +    if i == "0": +        ans.append("0") +    elif i == "1": +        ans.append("1") -        continue -print(("".join(b))) +        if len(ans) != 0: +            ans.pop() +        else: +            continue +print(("".join(ans)))