s = str(input())



ans = []

for i in s:

  if i == '0':

    ans.append('0')

  elif i == '1':

    ans.append('1')

  elif i == 'B':

    if ans == []:

      continue

    else:

      ans.pop()

print(*ans, sep='')

s=input()

data=[]

for i in range(len(s)):

  if s[i]=='0':

    data.append('0')

  elif s[i]=='1':

    data.append('1')

  else:

    if len(data)==0:

      continue

    else:

      data.pop()

print(*data,sep='')

s = str(input())
ans = []
for i in s:
    if i == "0":
        ans.append("0")
    elif i == "1":
        ans.append("1")
    elif i == "B":
        if ans == []:
            continue
        else:
            ans.pop()
print(*ans, sep="")

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

-s = str(input()) -ans = [] -for i in s: -    if i == "0": -        ans.append("0") -    elif i == "1": -        ans.append("1") -    elif i == "B": -        if ans == []: +s = input() +data = [] +for i in range(len(s)): +    if s[i] == "0": +        data.append("0") +    elif s[i] == "1": +        data.append("1") +    else: +        if len(data) == 0: -            ans.pop() -print(*ans, sep="") +            data.pop() +print(*data, sep="")