const val DREAM = "dream"
const val DREAMER = "dreamer"
const val ERASE = "erase"
const val ERASER = "eraser"

fun main(args: Array<String>) {
    var s = readLine()!!
    while(s.isNotEmpty()){
        when{
            s.endsWith(DREAMER)-> {
                s = s.substringBeforeLast(DREAMER)
            }
            s.endsWith(ERASER) -> {
                s = s.substringBeforeLast(ERASER)
            }
            s.endsWith(DREAM) -> {
                s = s.substringBeforeLast(DREAM)
            }
            s.endsWith(ERASE) -> {
                s = s.substringBeforeLast(ERASE)
            }
            else -> {
                println("NO")
                return
            }
        }
    }
    println("YES")
}