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()

    val candidates = List("dream", "dreamer", "erase", "eraser")

    @tailrec
    def isMatch(ss: List[String]): Boolean = {
      ss match {
        case Nil => false
        case s :: rest =>
          if (s == "") {
            true
          } else {
            isMatch(
              candidates.collect {
                case candidate: String if s.startsWith(candidate) =>
                  s.substring(candidate.length)
              } ++ rest
            )
          }
      }
    }

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