func main() {
    let A = ["dream", "dreamer", "erase", "eraser"]
    var S = readLine()!
    
    while let a = A.first(where: { S.hasSuffix($0) }) {
        S.removeLast(a.count)
    }
    
    if S.count == 0 {
        print("YES")
    } else {
        print("NO")
    }
}

main()
