object Main extends App {
  val string = scala.io.StdIn.readLine()
  val strings = List("dream", "dreamer", "erase", "eraser").map(_.reverse)

  def checkSuffix(target: String): String = {
    var res = ""
    for (e <- strings) {
      val reversed = target.reverse
      reversed match {
        case n if n.startsWith(e) && n.drop(e.length) == "" => println("YES"); sys.exit
        case n if n.startsWith(e) => checkSuffix(n.drop(e.length).reverse);
        case _ => res = "No"
      }
    }
    res
  }

  println(checkSuffix(string))
}
