fun main(args: Array<String>) {
    var s = readLine()!!
    val list = listOf("dream", "dreamer", "erase", "eraser")
    var can = true
    while (s.isNotEmpty()) {
        val length = s.length
        for (suffix in list) {
            if (s.endsWith(suffix)) {
                s = s.substring(0, s.length - suffix.length)
                break
            }
        }
        if (length == s.length) {
            can = false
            break
        }
    }
    if (can) {
        println("YES")
    } else {
        println("NO")
    }
}