open System

[<EntryPoint>]
let main argv = 
  let s = Console.ReadLine()
  
  let f t c = 
    match c with
    | '0' | '1' -> t + string c
    | 'B' -> 
      if t = "" then ""
      else t.Substring(0, t.Length - 1)
    | _ -> failwithf ""
  List.fold f "" [ for c in s -> c ]
  |> printfn "%s"
  0 // 整数の終了コードを返します
