

# -*- coding:utf-8 -*-                                                                                     

import numpy as np

import scipy as sp



s = eval(input())

n = len(s)

s_list = []



for i in range(0, n):

    if s[i] == 'B':

        if len(s_list) == 0:

            continue

        else:

            s_list.pop(-1)

    else:

        s_list.append(s[i])



S = ''

for i in range(0, len(s_list)):

    S = S + s_list[i]



print(S)



# -*- coding:utf-8 -*-                                                                                     



s = eval(input())

n = len(s)

s_list = []



for i in range(0, n):

    if s[i] == 'B':

        if len(s_list) == 0:

            continue

        else:

            s_list.pop(-1)

    else:

        s_list.append(s[i])



S = ''

for i in range(0, len(s_list)):

    S = S + s_list[i]



print(S)



# -*- coding:utf-8 -*-
import numpy as np
import scipy as sp

s = eval(input())
n = len(s)
s_list = []
for i in range(0, n):
    if s[i] == "B":
        if len(s_list) == 0:
            continue
        else:
            s_list.pop(-1)
    else:
        s_list.append(s[i])
S = ""
for i in range(0, len(s_list)):
    S = S + s_list[i]
print(S)

# -*- coding:utf-8 -*-
s = eval(input())
n = len(s)
s_list = []
for i in range(0, n):
    if s[i] == "B":
        if len(s_list) == 0:
            continue
        else:
            s_list.pop(-1)
    else:
        s_list.append(s[i])
S = ""
for i in range(0, len(s_list)):
    S = S + s_list[i]
print(S)

-import numpy as np -import scipy as sp -