(def dream  (reverse "dream"))
(def erase (reverse "erase"))
(def eraser (reverse "eraser"))
(def dreamer (reverse "dreamer"))
(defn daydream [S]
  (cond
    (empty? S) "YES"
    (let[s (take 5 S)](or (= s dream) (= s erase))) (daydream (drop 5 S))
    (= (take 6 S) eraser) (daydream (drop 6 S))
    (= (take 7 S) dreamer) (daydream (drop 7 S))
    :else "NO"))
 (println (daydream (reverse (read-line))))