main :: IO ()
main = getLine >>= putStrLn . edit

edit :: String -> String
edit = reverse . foldl f ""
  where
    f acc '0' = '0':acc
    f acc '1' = '1':acc
    f acc 'B' = safeTail acc

safeTail :: [a] -> [a]
safeTail [] = []
safeTail xs = tail xs