import std.stdio, std.string, std.conv, std.range, std.algorithm;

void main() {
  auto s = readln.chomp;
  char[] line;

  foreach (c; s) {
    if (c == 'B' && line.length > 0) {
      line = line.dropBackOne;
    } else if (c == '0' || c == '1') {
      line ~= c;
    }
  }

  line.writeln;
}
