'use strict'

function main(s) {

  const input = s.replace(/\n/g, '').split('');
  const result = [];
  input.forEach(x => {
    if(x === 'B') {
      result.pop();
    } else {
      result.push(x);
    }
  });
  console.log(result.join(''));
}

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