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