open System

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

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


let rec f str = 
    if Array.length str = 0 then true 
    else
        let ls=[ for c in cs do
                    if pre_match c str then
                        yield f (Array.skip (Array.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")
