import io.StdIn.readLine


object Main {

  def main(args: Array[String]): Unit = {
    var s = readLine()
    var state = 0

    while (state == 0) {
      if      (s.endsWith("dream"))   s = s.slice(0, s.length - 5)
      else if (s.endsWith("dreamer")) s = s.slice(0, s.length - 7)
      else if (s.endsWith("erase"))   s = s.slice(0, s.length - 5)
      else if (s.endsWith("eraser"))  s = s.slice(0, s.length - 6)
      else if (s.isEmpty) state = 1
      else              state = 2
    }
    state match {
      case 1 => println("YES")
      case 2 => println("NO")
    }
  }

}
