function Main(input) {
    const tape = input.trim().split('');
    const arr = []

    for (const v of tape) {
        if (v == 'B') {
            arr.pop();
        } else {
            arr.push(v);
        }
    }

    console.log(arr.join(''));
}

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