(* O(|s|) *)
let solve s =
  let rec loop i =
    if i <= 0 then
      "YES"
    else
      let match_size = List.fold_left
        (fun match_size each ->
          if match_size <> 0 then
            match_size
          else
            let len = String.length each in
            if i - len < 0 then
              match_size
            else
              if String.sub s (i - len) len = each then len else match_size)
        0
        ["dream"; "dreamer"; "erase"; "eraser"]
      in
        if match_size = 0 then
          "NO"
        else
          loop (i - match_size)
  in
    loop (String.length s)

let _ = read_line () |> solve |> print_endline