module Main where
import Control.Applicative

addStrs = ["dream", "dreamer", "erase" ,"eraser"]
minLen = 5-1

strCheck :: String -> String
strCheck s = if (strCheckCore s "") /= [] then
                 "YES"
             else
                 "NO"

strCheckCore :: String -> String -> [String]
strCheckCore ss ts = if length ss < length ts + minLen then
                         []
                     else
                         if ss == ts then
                             [ts]
                         else
                             foldr (++) [] $ strCheckCore ss <$> ( ( (++) ts ) <$> addStrs)

main :: IO()
main = do
    ss <- getLine
    putStrLn $ strCheck ss
