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