open System

let S = stdin.ReadLine()

let rec f (s:String) i (ret: String) =
    if i = s.Length then ret
    elif s.[i] = '0' then f s (i + 1) (ret + "0")
    elif s.[i] = '1' then f s (i + 1) (ret + "1")
    elif s.[i] = 'B' then f s (i + 1) (if ret.Length > 0 then (ret.Substring(0, ret.Length - 1)) else ret)
    else ""
               
f S 0 "" |> printfn "%s"
