func main() {
    let S = Array(readLine()!)
    let n = S.count
    let A: Set = ["dream", "dreamer", "erase", "eraser"]
    
    var s = ""
    for i in 1...n {
        s.insert(S[n - i], at: s.startIndex)
        if s.count > 7 {
            print("NO")
            return
        }
        if A.contains(s) {
            s = ""
        }
    }
    
    if s.count == 0 {
        print("YES")
    } else {
        print("NO")
    }
}

main()
