fun main(args: Array<String>) {
    val s = readLine()!!

    var cnt = 0
    var j = s.length - 1

    for (i in (s.length - 1).downTo(0)) {
        if (j - i > "dreamer".length) {
            break
        }
        for (dd in arrayOf("dream", "dreamer", "erase", "eraser")) {
            if (s.slice(i..j) == dd) {
                j = i - 1
                cnt += dd.length
            }
        }
    }

    if (s.length == cnt) {
        println("YES")
    } else {
        println("NO")
    }
}
