function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var list = [];
  for(var i = 0; i < input.length; i++){
    var tmp = input.slice(i,i+1);
    if(tmp != "B"){
       list.push(tmp);
    }else if(list.length > 0){
       list.pop();      
    }
  }
  myout(list.join(""));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
