"use strict";

const main = input => {
  input = input.split("\n")[0];
  
  var arr = [];
  for (var i = 0; i < input.length; i++) {
    var s = input[i];
    
    if( s == '0') arr.push('0');
    else if( s == '1') arr.push('1');
    else if( s == 'B') {
      if( arr.length != 0 ){
        arr.pop();
      }
    }
  }
  console.log(arr.join(''));
  
}

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