open System
open System.Diagnostics


let words = [|"dream"; "dreamer"; "erase"; "eraser"|]
let s = stdin.ReadLine()
let len = s.Length

let inline subStrEq (m:int) (n:int) (ss:string) =
  let e = m+n
  if e > len
  then false
  else
    seq {m..(e-1)}
    |> Seq.map (fun i -> s.[i])
    |> Seq.compareWith Operators.compare ss
    |> (=) 0

let inline startsWith (pos:int) (pre:string) =
  let l = pre.Length
  if subStrEq pos l pre
  then Some(l)
  else None

let rec judge (pos:int) =
  if pos = len then
    true
  else
    words
    |> Seq.choose (startsWith pos)
    |> Seq.map ((+) pos)
    |> Seq.exists judge

if judge 0 then "YES" else "NO"
|> printfn "%s"