func cutTail(suffix: String, str: String) -> String {
    var tempStr = str
    for _ in 1...suffix.count {
        tempStr = String(tempStr.dropLast())
    }
    return tempStr
}

func main() {
    var line = readLine()!
    let words = ["dream", "dreamer", "erase", "eraser"]
    while true {
        if line.count == 0 {
            print("YES")
            return
        }
        var exists = false
        for s in words {
            if line.hasSuffix(s) {
                line = cutTail(suffix: s, str: line)
                exists = true
                break
            }
        }
        if !exists {
            break
        }
    }
    print("NO")
}

main()
