s = eval(input())

l = []

for i in s:

	if i=='B':

		l=l[:-1]

	else:

		l.append(i)

print(("".join(l)))
s = input()

len = 0

op = []



for i in s:

    if(i == '1'):

        op.append('1')

        len += 1

    elif(i == '0'):

        op.append('0')

        len += 1

    elif(i == 'B'):

        if(len > 0):

            op.pop()

            len = len - 1



for i in op:

    print(i, end = '')

s = eval(input())
l = []
for i in s:
    if i == "B":
        l = l[:-1]
    else:
        l.append(i)
print(("".join(l)))

s = input()
len = 0
op = []
for i in s:
    if i == "1":
        op.append("1")
        len += 1
    elif i == "0":
        op.append("0")
        len += 1
    elif i == "B":
        if len > 0:
            op.pop()
            len = len - 1
for i in op:
    print(i, end="")

-s = eval(input()) -l = [] +s = input() +len = 0 +op = [] -    if i == "B": -        l = l[:-1] -    else: -        l.append(i) -print(("".join(l))) +    if i == "1": +        op.append("1") +        len += 1 +    elif i == "0": +        op.append("0") +        len += 1 +    elif i == "B": +        if len > 0: +            op.pop() +            len = len - 1 +for i in op: +    print(i, end="")