import scala.io.StdIn._

trait Solver extends App {
  implicit class Pipe[T](x: T) {
    def |>[U](f: T => U) = f(x)
  }

  class Prefix(prefix: String) {
    def unapply(s: String) = {
      if(s.startsWith(prefix)) Some(s.stripPrefix(prefix))
      else None
    }
  }

  val dream = new Prefix("dream".reverse)
  val dreamer = new Prefix("dreamer".reverse)
  val erase = new Prefix("erase".reverse)
  val eraser = new Prefix("eraser".reverse)

  def solve(s: String): Boolean = s match {
    case "" => true
    case dream(tail)   => solve(tail)
    case dreamer(tail) => solve(tail)
    case erase(tail)   => solve(tail)
    case eraser(tail)  => solve(tail)
    case _ => false
  }
}

object Main extends Solver {
  val s = readLine().reverse
  solve(s) match {
    case true => println("YES")
    case false => println("NO")
  }
}