func main() {
    var line = readLine()!
    let words = ["dream", "dreamer", "erase", "eraser"]
    while true {
        let s = words.first(where: { (word) -> Bool in
            line.hasSuffix(word)
        })
        if let s = s {
            line.removeLast(s.count)
        } else {
            break
        }
    }
    if line.count == 0 {
        print("YES")
    } else {
        print("NO")
    }
}

main()
