import Control.Monad

check :: String -> Bool
check xs
  | null xs = True
  | elem five ["dream", "erase"] = check aftfive
  | elem six ["eraser"] = check aftsix
  | elem seven ["dreamer"] = check aftseven
  | otherwise = False
              where (five, aftfive) = (take 5 xs, drop 5 xs)
                    (six, aftsix) = (take 6 xs, drop 6 xs)
                    (seven, aftseven) = (take 7 xs, drop 7 xs)

main = do
  string <- getLine :: IO String
  if check string then putStrLn "YES" else putStrLn "NO"