fun main(args: Array<String>) {
    val sb = StringBuilder( readLine()!! )
    val w = listOf("dream","dreamer","erase","eraser")
 
    while (sb.isNotEmpty()){
        val erase = w.find { sb.endsWith(it) }
        if(erase==null){
            println("NO")
            return
        }else{
            sb.delete(sb.length-erase.length , sb.length)
        }
    }
    println("YES")
}