import Control.Arrow ((&&&))
import Data.List

isDream, isDreamer, isErase, isEraser :: String -> Bool
[(isDream, lenDream),
 (isDreamer, lenDreamer),
 (isErase, lenErase),
 (isEraser, lenEraser)] = map (isPrefixOf . reverse &&& length) ["dream", "dreamer", "erase", "eraser"]

exist :: String -> Bool
exist sna
  | null sna = True
  | isDream sna = exist $ drop lenDream sna
  | isDreamer sna = exist $ drop lenDreamer sna
  | isErase sna = exist $ drop lenErase sna
  | isEraser sna = exist $ drop lenEraser sna
  | otherwise = False

main :: IO ()
main = do
  ans <- getLine
  putStrLn $ if exist (reverse ans) then "YES" else "NO"
