open System
let readInt () = stdin.ReadLine() |> int
let readIntArray () = stdin.ReadLine().Split(' ') |> Array.map int

let S = stdin.ReadLine()
let N = S.Length
let dp : bool [] = Array.zeroCreate (N + 1)

let candi = [ "dream"; "dreamer"; "erase"; "eraser" ]

dp.[0] <- true
for i in [0..N-1] do
    if dp.[i] then
       candi |> List.iter (fun str -> if (i + str.Length <= N && S.Substring(i, str.Length) = str ) then (dp.[i + str. Length] <- true))

if dp.[N] then "YES" else "NO"
|> printfn "%s"
