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 is_nomatch str = 
    List.map (fun c -> if List.length c <= List.length str then List.take (List.length c) str = c else false) cs |> List.exists (fun b -> b)

let rec valid str = 
    if List.length str = 0 then true
    else if not (is_nomatch str) then false
    else
        let se = seq{
            for c in cs do
                let sz = List.length c
                if sz <= List.length str && List.take sz str = c then
                    yield (valid (List.skip sz str))
        }
        Seq.exists (fun b -> b) se

printfn "%s" <| if valid s then "YES" else "NO"
