import scala.io.StdIn._

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

  class Prefix(prefix: List[Char]) {
    val size = prefix.size

    def unapply(s: List[Char]) = {
      if(s.startsWith(prefix)) Some(s.drop(size))
      else None
    }
  }

  object Prefix {
    def apply(prefix: String): Prefix = {
      new Prefix(prefix.toList)
    }
  }

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

  def solve(s: List[Char]): Boolean = s match {
    case List() => 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().toList.reverse
  solve(s) match {
    case true => println("YES")
    case false => println("NO")
  }
}