main :: IO ()
main = do
  s <- getLine
  let
    solve ans [] = ans
    solve xs (y:ys)
      | y == 'B' = if null xs then solve xs ys else solve (tail xs) ys
      | otherwise = solve (y:xs) ys
  putStrLn $ reverse $ solve [] s
