open System;
[<EntryPoint>]
let main argv = 
    let rec check (s : string ) = 
        if ( s = "dreamer" || s.StartsWith("dreamerd") || s.StartsWith("dreamere")) then ( check (s.Substring(7)))
        elif s.StartsWith("dream") then ( check (s.Substring(5)))
        elif s.StartsWith("eraser") then ( check (s.Substring(6)))
        elif s.StartsWith("erase") then ( check (s.Substring(5)))
        elif s = "" then true
        else false

    let str = System.Console.ReadLine()
    let res = if (check str) then "YES" else "NO"
    printfn "%s" res
    0 // 整数の終了コードを返します