open System

let cs : char list list = ["dream";"dreamer";"erase";"eraser"] |> List.map (fun x -> x.ToCharArray() |> Array.rev |> Array.toList)
let s : char list = stdin.ReadLine().ToCharArray() |> Array.rev |> Array.toList

let pre_match a b =
    let sa = List.length a
    let sb = List.length b
    if sb < sa then
        false
    else 
        let res = (a = List.take sa b)
        res


let rec f str = 
    if List.length str = 0 then true 
    else
        let ls=[ for c in cs do
                    if pre_match c str then
                        yield f (List.skip (List.length c) str) ]
        assert (List.length ls <= 1)
        if List.exists (fun x -> x) ls then true else false

printfn "%s" (if f s then "YES" else "NO")
