object Main extends App {

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

  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")
  }
}
