def main():

    s = eval(input())

    ans = ""

    for c in s:

        if c == "0":

            ans += "0"

        elif c == "1":

            ans += "1"

        elif c == "B":

            ans = ans[:-1]

    print(ans)



if __name__ == '__main__':

    main()

from collections import defaultdict





def main():

    s = eval(input())

    ans = ""

    for c in s:

        if c in ["0", "1"]:

            ans += c

        elif c == "B" and len(ans) > 0:

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

    print(ans)



if __name__ == '__main__':

    main()

def main():
    s = eval(input())
    ans = ""
    for c in s:
        if c == "0":
            ans += "0"
        elif c == "1":
            ans += "1"
        elif c == "B":
            ans = ans[:-1]
    print(ans)


if __name__ == "__main__":
    main()

from collections import defaultdict


def main():
    s = eval(input())
    ans = ""
    for c in s:
        if c in ["0", "1"]:
            ans += c
        elif c == "B" and len(ans) > 0:
            ans = ans[: len(ans) - 1]
    print(ans)


if __name__ == "__main__":
    main()

+from collections import defaultdict + + -        if c == "0": -            ans += "0" -        elif c == "1": -            ans += "1" -        elif c == "B": -            ans = ans[:-1] +        if c in ["0", "1"]: +            ans += c +        elif c == "B" and len(ans) > 0: +            ans = ans[: len(ans) - 1]