eater::[Char] ->  Char  -> [Char]
eater ls c = case c of
             '0' -> '0':ls
             '1' -> '1':ls
             'B' -> if ls == [] then [] else tail ls

main::IO()
main=do
  str<-getLine
  putStr (reverse (foldl eater [] str))
  putStr "\n"