import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  com <- BS.unpack <$> BS.getLine :: IO String
  putStr $ trim com ""

trim :: String -> String -> String
trim [] y = reverse y
trim (x:xs) y 
  | x == '0' = trim xs (x:y)
  | x == '1' = trim xs (x:y)
  | x == 'B' && y == mempty = trim xs y
  | x == 'B' = trim xs (tail y)
