local s=io.read()
local daydream={"dream","dreamer","erase","eraser"}

while true do
    local flag=false
    for j=1,4 do
        local l=#s-#daydream[j]
        if s:sub(l+1)==daydream[j] then
            s=s:sub(1,l)
            flag=true
        end
    end
    if not flag then
        print("NO")
        break
    elseif s=="" then
        print("YES")
        break
    end
end