open Bytes
let s = read_line ()
let b = of_string s
let i = ref 0
let _ = String.iter (function 'B' -> i := max 0 @@ !i - 1 | c -> set b !i c; incr i) s;
  iteri (fun j c -> if j < !i then print_char c) b; print_newline ()