#!/usr/bin/env python3

from collections import defaultdict

import sys

sys.setrecursionlimit(10**8)

input = sys.stdin.readline



s = input().rstrip()

ans = []

for ch in s:

    if ch == "0":

        ans.append("0")

    elif ch == "1":

        ans.append("1")

    else:

        if len(ans) > 0:

            ans.pop()

print(("".join([item for item in ans])))
#!/usr/bin/env python3

import sys

input = sys.stdin.readline



s = input().rstrip()

ans = [] 

for ch in s:

    if ch in "01":

        ans.append(ch)

    if ch == "B" and ans:

        ans.pop()

print(("".join([item for item in ans])))
#!/usr/bin/env python3
from collections import defaultdict
import sys

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
s = input().rstrip()
ans = []
for ch in s:
    if ch == "0":
        ans.append("0")
    elif ch == "1":
        ans.append("1")
    else:
        if len(ans) > 0:
            ans.pop()
print(("".join([item for item in ans])))

#!/usr/bin/env python3
import sys

input = sys.stdin.readline
s = input().rstrip()
ans = []
for ch in s:
    if ch in "01":
        ans.append(ch)
    if ch == "B" and ans:
        ans.pop()
print(("".join([item for item in ans])))

-from collections import defaultdict -sys.setrecursionlimit(10**8) -    if ch == "0": -        ans.append("0") -    elif ch == "1": -        ans.append("1") -    else: -        if len(ans) > 0: -            ans.pop() +    if ch in "01": +        ans.append(ch) +    if ch == "B" and ans: +        ans.pop()