function Main(s) {
  var ans = [];
  for(var i = 0; i < s.length; i++){
    if(s[i] === "B") ans.pop();
    else ans.push(s[i]);
  }
	console.log(ans.join(""));
}

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