fun main(args: Array<String>) {
    abc049c()
}

fun abc049c() {
    var s = readLine()!!
    val words = listOf("dream", "dreamer", "erase", "eraser")

    while (s.isNotBlank()) {
        if (words.none { word ->
                if (s.endsWith(word)) {
                    s = s.slice(0..s.lastIndex - word.length)
                    true
                } else false
            }) return println("NO")
    }

    println("YES")
}
