import Foundation
let arr = ["dream", "erase", "eraser", "dreamer"]
var S = readLine()!
while true {
    var flag = true
    for s in arr {
        if S.hasSuffix(s) {
            S = S.substringToIndex(S.endIndex.advancedBy(-s.characters.count))
            flag = false
        }
    }
    if flag {
        break
    }
}
print(S=="" ?"YES":"NO")