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 = Console.ReadLine().ToCharArray() |> Array.rev |> Array.toList

let pre_match a b =
    try
        let sub = List.take (List.length a) b
        a = sub
    with
        | _ -> false


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

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