    fun main(args: Array<String>) {
        val input = read()
        println(daydream(input))
    }

    enum class Choices { dream, dreamer, erase, eraser }

    fun read(): String {
        return readLine()!!
    }

    fun daydream(input: String): String {
        val reversed = input.reversed()
        val reversedChoices = Choices.values().map { it.name.reversed() }

        tailrec fun erasing(str: String): Boolean {
            if (str.isEmpty()) return true
            val found = reversedChoices.find { it.substring(0, 3) == str.substring(0, 3) }
            if (found == null || str.length < found.length || str.substring(0, found.length) != found)
                return false
            else
                return erasing(str.drop(found.length))
        }

        return if (erasing(reversed)) "YES" else "NO"
    }