const fs = require('fs')
const cin = "0100BBBBB11";//fs.readFileSync('/dev/stdin', 'utf8');



var a = [];
for (var i = 0; i < cin.length; ++i){
    switch(cin[i]){
        case '0':
            a.push('0'); break;
        case '1':
            a.push('1'); break;
        case 'B':
            if (a.length > 0)
                a.pop();
            break;
    }
}
console.log(a.join(''));