import Data.List

main :: IO ()
main = do
  input <- getLine
  putStrLn . reverse $ foldl' edit "" input

edit :: String -> Char ->  String
edit (_:str) 'B' = str
edit [] 'B' = []
edit str c = c : str
