object Main extends App {

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

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

  if (es.foldLeft(input)((s, e) => s.replace(e, "")).length == 0)
    println("YES")
  else
    println("NO")
}
