object Main extends App {
  val input: String = scala.io.StdIn.readLine // S

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

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