fun main(args: Array<String>) {
    var input = readLine()!!.reversed()
    val candidate = listOf("dream".reversed(), "dreamer".reversed(), "erase".reversed(), "eraser".reversed())

    var left = 0
    var flag = true
    while(left < input.length) {
        var flag2 = true
        for (i in 0 until candidate.size) {
            val target = candidate[i]
            val right = left + target.length

            if (right <= input.length && input.substring(left, right) == target) {
                left += target.length
                flag2 = false
                break
            }
        }

        if(flag2){
            flag = false
            break
        }
    }

    if (flag) print("YES") else print("NO")
}