def typing(s, ans):

    for i in range(len(s)):

        if s[i] == '0':

            ans += '0'

        if s[i] == '1':

            ans += '1'

        if s[i] == 'B' and ans != '':

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



    print(ans)



S = str(eval(input()))

ANS = ''

typing(S, ANS)
def typing(s, ans):

    for i in range(len(s)):

        if s[i] == '0':

            ans.append('0')

        elif s[i] == '1':

            ans.append('1')

        elif s[i] == 'B' and len(ans) != 0:

            ans.pop()

        else:

            continue



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



S = str(eval(input()))

ANS = []

typing(S, ANS)
def typing(s, ans):
    for i in range(len(s)):
        if s[i] == "0":
            ans += "0"
        if s[i] == "1":
            ans += "1"
        if s[i] == "B" and ans != "":
            ans = ans[: len(ans) - 1]
    print(ans)


S = str(eval(input()))
ANS = ""
typing(S, ANS)

def typing(s, ans):
    for i in range(len(s)):
        if s[i] == "0":
            ans.append("0")
        elif s[i] == "1":
            ans.append("1")
        elif s[i] == "B" and len(ans) != 0:
            ans.pop()
        else:
            continue
    print(("".join(ans)))


S = str(eval(input()))
ANS = []
typing(S, ANS)

-            ans += "0" -        if s[i] == "1": -            ans += "1" -        if s[i] == "B" and ans != "": -            ans = ans[: len(ans) - 1] -    print(ans) +            ans.append("0") +        elif s[i] == "1": +            ans.append("1") +        elif s[i] == "B" and len(ans) != 0: +            ans.pop() +        else: +            continue +    print(("".join(ans))) -ANS = "" +ANS = []