li = list(eval(input()))

ans = []

for i in range(len(li)):

    if (li[i] == '0') or (li[i] == '1'):

        ans.append(li[i])

    elif len(ans) > 0:

        ans.pop()

    else:

        pass



print((''.join(ans)))
s =eval(input())

ans = []

for i in range(len(s)):

    if (s[i] == '0') or (s[i] == '1'):

        ans.append(s[i])

    elif ans ==[]:

        continue

    else:

        ans.pop()



print((''.join(ans)))
li = list(eval(input()))
ans = []
for i in range(len(li)):
    if (li[i] == "0") or (li[i] == "1"):
        ans.append(li[i])
    elif len(ans) > 0:
        ans.pop()
    else:
        pass
print(("".join(ans)))

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

-li = list(eval(input())) +s = eval(input()) -for i in range(len(li)): -    if (li[i] == "0") or (li[i] == "1"): -        ans.append(li[i]) -    elif len(ans) > 0: +for i in range(len(s)): +    if (s[i] == "0") or (s[i] == "1"): +        ans.append(s[i]) +    elif ans == []: +        continue +    else: -    else: -        pass