fun main(args: Array<String>) {
    val S = readLine()!!.reversed()

    val prefixes = arrayOf("dream", "dreamer", "erase", "eraser").map { it.reversed() }

    // println(S.substring(2))
    var idx = 0
    while (idx < S.length) {
        var yes = false
        for(p in prefixes) {
            if (S.substring(idx).startsWith(p)) {
                idx += p.length
                yes = true
                break
            }
        }
        if (!yes) break
    }
    if (idx == S.length) println("YES") else println("NO")
}