import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  str <- getLine
  putStrLn $ foldl imput [] str
  
imput result x
  |x=='0' = result ++ "0"
  |x=='1' = result ++ "1"
  |x=='B' = safeinit result

safeinit [] = []
safeinit str = init str