fun main(arg: Array<String>) {
    var S = next()
    val K = listOf("dream", "dreamer", "erase", "eraser")
    while (true) {
        if (S.length == 0) return println("YES")
        var f = false
        for (n in K.indices)
            if (S.endsWith(K[n])) {
                S = S.substring(0, S.length - K[n].length)
                f = true
                break
            }
        if (!f) return println("NO")
    }
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
