s = eval(input())

a = ""

for i in range(len(s)):

	if s[i] == "0":

		a += "0"

	elif s[i] == "1":

		a += "1"

	else:

		if a != "":

			a = a[:len(a)-1]

print(a)



s = eval(input())

ans = ""

for l in s:

    if l == "B":

        ans = ans[:-1]

    else:

        ans += l

print(ans)
s = eval(input())
a = ""
for i in range(len(s)):
    if s[i] == "0":
        a += "0"
    elif s[i] == "1":
        a += "1"
    else:
        if a != "":
            a = a[: len(a) - 1]
print(a)

s = eval(input())
ans = ""
for l in s:
    if l == "B":
        ans = ans[:-1]
    else:
        ans += l
print(ans)

-a = "" -for i in range(len(s)): -    if s[i] == "0": -        a += "0" -    elif s[i] == "1": -        a += "1" +ans = "" +for l in s: +    if l == "B": +        ans = ans[:-1] -        if a != "": -            a = a[: len(a) - 1] -print(a) +        ans += l +print(ans)