s = eval(input())

ans = ""

for e in s:

    if e == "0":

        ans += "0"

    elif e == "1":

        ans += "1"

    else:

        if len(ans) > 0:

            ans = ans[:-1]

print(ans)

import sys, math



def input():

    return sys.stdin.readline()[:-1]



def main():

    S = eval(input())

    ans = ""

    for e in S:

        if e == "B":

            ans = ans[:-1]

        else:

            ans += e

    print(ans)

if __name__ == '__main__':

    main()

s = eval(input())
ans = ""
for e in s:
    if e == "0":
        ans += "0"
    elif e == "1":
        ans += "1"
    else:
        if len(ans) > 0:
            ans = ans[:-1]
print(ans)

import sys, math


def input():
    return sys.stdin.readline()[:-1]


def main():
    S = eval(input())
    ans = ""
    for e in S:
        if e == "B":
            ans = ans[:-1]
        else:
            ans += e
    print(ans)


if __name__ == "__main__":
    main()

-s = eval(input()) -ans = "" -for e in s: -    if e == "0": -        ans += "0" -    elif e == "1": -        ans += "1" -    else: -        if len(ans) > 0: +import sys, math + + +def input(): +    return sys.stdin.readline()[:-1] + + +def main(): +    S = eval(input()) +    ans = "" +    for e in S: +        if e == "B": -print(ans) +        else: +            ans += e +    print(ans) + + +if __name__ == "__main__": +    main()