main=do
 s<-getLine
 putStrLn (f s (length s) "")
  where f _   0 a = a
        f "B" 1 a = g a
        f s   1 a = a++s
        f s n a = f (tail s) (n-1) (if s!!0=='B' then (g a) else a++[s!!0])
        g "" = ""
        g a  = init a