(* 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 j = ref 0 in
    let is_ok = ref false in
    while !j < 4 && not !is_ok do
      let m = String.length ws.(!j) in
      if String.sub s (max 0 @@ !i - m + 1) @@ m = ws.(!j) then (i := !i - m; is_ok := true);
      incr j done;
    if not !is_ok then (print_endline "NO"; exit 0) done;
  print_endline "YES"