'use strict';
function Main(input) {
let result = []

for (let i=0; i<input.length; i++) {
  distingish(input[i]);
}

function distingish(str) {
  switch (str) {
    case "0":
      result.push("0");
      break;
    case "1":
      result.push("1");
      break;
    case "B":
      result.pop();
      break;
  }
}

console.log(result.join(""));

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