import Data.List

matcher s = filter (\x -> isSuffixOf x s) ["dream", "dreamer", "erase", "eraser"]

recInit s n = if n > 0 then recInit (init s) (n-1) else s

matching "" = "YES"
matching str =
  let x = matcher str
  in if length x  > 0 then matching (recInit str (length . head $ x)) else "NO"

main = getLine >>= putStrLn . matching