object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s = sc.next()

  def solve(s: String): Boolean = {
    if (s.isEmpty) {
      true
    } else if (s.endsWith("dream")) {
      solve(s.dropRight(5))
    } else if (s.endsWith("dreamer")) {
      solve(s.dropRight(7))
    } else if (s.endsWith("erase")) {
      solve(s.dropRight(5))
    } else if (s.endsWith("eraser")) {
      solve(s.dropRight(6))
    } else {
      false
    }
  }

  if (solve(s)) {
    println("YES")
  } else {
    println("NO")
  }
}
