s=eval(input())

result = []

for i in s:

  if i=='0':

    result.append('0')

  elif i=='1':

    result.append('1')

  elif i=='B':

    if not result:

      continue

    result.pop()

print((''.join(result)))
n=[]

for i in input():

  if i=='B':

    if n: n.pop()

  else:

    n.append(i)

print(*n,sep='')

s = eval(input())
result = []
for i in s:
    if i == "0":
        result.append("0")
    elif i == "1":
        result.append("1")
    elif i == "B":
        if not result:
            continue
        result.pop()
print(("".join(result)))

n = []
for i in input():
    if i == "B":
        if n:
            n.pop()
    else:
        n.append(i)
print(*n, sep="")

-s = eval(input()) -result = [] -for i in s: -    if i == "0": -        result.append("0") -    elif i == "1": -        result.append("1") -    elif i == "B": -        if not result: -            continue -        result.pop() -print(("".join(result))) +n = [] +for i in input(): +    if i == "B": +        if n: +            n.pop() +    else: +        n.append(i) +print(*n, sep="")