object Main extends App {

  def partAll(s: String, es: List[String]): Boolean = {
    def partAll(s: String): Boolean = {
      if (s.length == 0) true
      else {
        es.find(e => {
          if(s.slice(0, e.length) == e)
            partAll(s.drop(e.length))
          else
            false
        }) match {
          case None => false
          case Some(_) => true
        }
      }
    }

    partAll(s)
  }

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

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

  partAll(input, es) match {
    case false => println("NO")
    case true  => println("YES")
  }
}
