fun main(args: Array<String>) {
    val input = readLine()!!.reversed()
    val words = listOf("dream", "dreamer", "erase", "eraser").map(String::reversed)
    val wl = words.map{it to it.length}
    var position = 0
    val len = input.length
    var ret = true
    loop@ while(position < len){
        for((w, l) in wl){
            if(position + l < len + 1 && input.substring(position, position + l) == w){
                position += l
                continue@loop
            }
        }
        ret = false
        break@loop
    }
    print(if(ret)"YES" else "NO")
}