import Control.Applicative
main :: IO ()
main = do
    sigInput <-getLine
    let ans = editor sigInput []
    putStrLn $ ans
editor :: String -> String -> String
editor [] ys = ys
editor (x:xs) ys
    | x == 'B' = editor xs (if null ys then "" else init ys)
    | otherwise = editor xs (ys ++ [x])
