let asReversedString s =
  String.of_seq (List.to_seq (List.rev (List.of_seq (String.to_seq s))))

let isPrefix prefixString targetString =
  let prefixLength = String.length prefixString in
  let targetLength = String.length targetString in
  if prefixLength <= targetLength
  then
    let targetSub = String.sub targetString 0 prefixLength in
    prefixString = targetSub
  else
    false

let removePrefix prefixString targetString =
  let prefixLength = String.length prefixString in
  let targetLength = String.length targetString in
  let newTargetStart = prefixLength in 
  let newTargetLength = targetLength - prefixLength in
  String.sub targetString newTargetStart newTargetLength

let satisfy inS =
  let reversed = asReversedString inS in
  let word1 = asReversedString "dream" in
  let word2 = asReversedString "dreamer" in
  let word3 = asReversedString "erase" in
  let word4 = asReversedString "eraser" in
  let rec satisfy_aux s =
    if s = "" then true else
      if isPrefix word1 s then satisfy_aux (removePrefix word1 s) else
        if isPrefix word2 s then satisfy_aux (removePrefix word2 s) else
          if isPrefix word3 s then satisfy_aux (removePrefix word3 s) else
            if isPrefix word4 s then satisfy_aux (removePrefix word4 s) else
              false in
  satisfy_aux reversed
    

let main () =
  let s = read_line () in
  let ans = if satisfy s
            then "YES"
            else "NO" in
  (
    Printf.printf "%s" ans;
    print_newline ()
  )

let _ = main ()
