object Main extends App {

  val es: List[String] = List("eraser", "erase", "dreamer", "dream")

  @scala.annotation.tailrec
  def matchAll(ls: List[String]): Boolean = ls match {
    case Nil     => false
    case s::ss   => {
      val ms = es.filter(e => s.slice(0, e.length) == e).map(m => s.drop(m.length))
      ms.filter(_ == "").length match {
        case len if len >= 1 => true
        case _               => matchAll(ms ++ ss)
      }
    }
  }

  val input: String = scala.io.StdIn.readLine // S

  if (matchAll(input::Nil))
    println("YES")
  else
    println("NO")
}