s = str(eval(input()))

l = []

for i in range(len(s)):

    if s[i] == '0':

        l.append('0')

    elif s[i] == '1':

        l.append('1')

    else:

        if l:

            l.pop()

print((''.join(l)))

s = str(eval(input()))

ans = []

for i in range(len(s)):

    if s[i] == '0':

        ans.append('0')

    elif s[i] == '1':

        ans.append('1')

    else:

        if ans:

            ans.pop()

print((''.join(ans)))

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

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

-l = [] +ans = [] -        l.append("0") +        ans.append("0") -        l.append("1") +        ans.append("1") -        if l: -            l.pop() -print(("".join(l))) +        if ans: +            ans.pop() +print(("".join(ans)))