#!/usr/bin/env fsharpi

open System;

let readIntN ( str : string ) =
    str.Split(' ')
    |> Array.map System.Int32.Parse

let readInt1 ( str : string ) =
    readIntN str |> fun arr -> arr.[0]

let readInt2 ( str : string ) =
    readIntN str |> fun arr -> (arr.[0],arr.[1])

let readInt3 ( str : string ) =
    readIntN str |> fun arr -> (arr.[0],arr.[1],arr.[2])

let rec parse ( str : string ) =
    if str.StartsWith "dreamerd" then parse (str.Substring 7) else
    if str.StartsWith "dreamere" then parse (str.Substring 7) else
    if str.StartsWith "eraser" then parse (str.Substring 6) else
    if str.StartsWith "dream" then parse (str.Substring 5) else
    if str.StartsWith "erase" then parse (str.Substring 5) else
    str
Console.ReadLine()
|> fun s -> if (parse s) = "" then "YES" else "NO"
|> Console.WriteLine

