//
//  main.swift
//  Atcoder
//
//  Created by Louis Joe Shen on 2020/9/26.
//  Copyright © 2020 Louise Joe Shen. All rights reserved.
//

import Foundation

var input = readLine()!

var ans = ""

for i in input{
    if i == "B"{
        if ans.isEmpty{
            //doing nothing
        }else{
            ans.removeLast()
        }
    }else{
        ans += String(i)
    }
}

print(ans)
