import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val s = in.readLine().reverse

    val candidates = List("dream", "dreamer", "erase", "eraser").map(_.reverse)

    @tailrec
    def isMatch(s: String): Boolean = {
      if (s == "") {
        true
      } else {
        candidates.find(s.startsWith) match {
          case Some(c) => isMatch(s.substring(c.length))
          case None => false
        }
      }
    }

    out.println(
      if (isMatch(s)) {
        "YES"
      } else {
        "NO"
      }
    )
    out.flush()
  }
}
