let substr (s: string) =
    if s.Substring(s.Length - 5) = "dream" then Some(s.Substring(0, s.Length - 5))
    elif s.Substring(s.Length - 5) = "erase" then Some(s.Substring(0, s.Length - 5))
    elif s.Substring(s.Length - 6) = "eraser" then Some(s.Substring(0, s.Length - 6))
    elif s.Substring(s.Length - 7) = "dreamer" then Some(s.Substring(0, s.Length - 7))
    elif s = "" then Some("")
    else None

let rec fc s =
    match substr s with
    | Some x ->
        match x with
        | "" -> "YES"
        | _ -> fc x
    | _ -> "NO"



let main () = stdin.ReadLine() |> fc |> printfn "%s"

main()