function Main(input) {
  const array = input.split('');
  let output = '';
  array.forEach(e => {
    if (e == '0') {
      output += '0';
    } else if (e == '1') {
      output += '1';
    } else if (output.length != 0) {
      output = output.slice(0, -1);
    }
  });
  console.log(output);
}

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