import Control.Monad
import Control.Applicative
import Data.List

main = do
    s <- getLine
    
    putStrLn (f [] s)
    


f xs [] = xs
--f xs ('0':ss) = f (xs : "0") ss
--f xs ('1':ss) = f (xs : "1") ss
f xs (x:ss) = if (x == 'B') then
                             if (xs == [])
                             then f xs ss
                             else f (init xs) ss
              else f (xs ++ [x]) ss