@staticmethod
def b():
    s = sys.stdin.readline().rstrip()
    t = ''
    for c in s:
        if (c == 'B'):
            t = t[:(- 1)]
        else:
            t += c
    print(t)
@staticmethod
def b():
    s = sys.stdin.readline().rstrip()
    t = 
    for c in s:
        if (c == 'B'):
            t = t[:(- 1)]
        else:
            t += c
    print(t)