import Data.Bool   (bool)
import Data.List   (isPrefixOf, stripPrefix)
import Data.Maybe  (isJust)
import Data.Monoid (First (First, getFirst), (<>))

main :: IO ()
main = do
    s <- getLine
    answer $ solve s

type Answer = Bool
answer :: Answer -> IO ()
answer = putStrLn . bool "NO" "YES"

solve :: String -> Answer
solve = isJust . inner False
  where
    inner dream s
      | null s    = return ()
      | otherwise = do
        let
          prefices = ["dream", "eraser", "erase"]
          dreamer  = First $ bool Nothing (stripPrefix "er" s) dream
        suffix <- getFirst $ foldMap (First . flip stripPrefix s) prefices <> dreamer
        inner ("dream" `isPrefixOf` s) suffix
