(* O(|s|) *)
let s = read_line ()
let i = ref @@ String.length s - 1
let ws = [|"dream"; "dreamer"; "erase"; "eraser"|]
let _ =
  while !i >= 0 do
    let f b w =
      if b then b
      else
        let m = String.length w in
        if String.sub s (max 0 @@ !i - m + 1) @@ m = w then (i := !i - m; true) else b in
    if not @@ Array.fold_left f false ws then (print_endline "NO"; exit 0) done;
  print_endline "YES"