fun main(args: Array<String>) {
    val s = StringBuilder(readLine()!!)
    while (s.isNotEmpty()) {
        if (s.endsWith("dream")) {
            s.delete(s.length - 5, s.length)
        } else if (s.endsWith("dreamer")) {
            s.delete(s.length - 7, s.length)
        } else if (s.endsWith("erase")) {
            s.delete(s.length - 5, s.length)
        } else if (s.endsWith("eraser")) {
            s.delete(s.length - 6, s.length)
        } else {
            println("NO")
            return
        }
    }
    println("YES")
}
