import Data.Bool
import Data.List

main = interact $ bool "NO" "YES" . sol

sol s
  | null s                = True
  | ts!!0 `isSuffixOf` s  = sol (take (length s-5) s)
  | ts!!1 `isSuffixOf` s  = sol (take (length s-7) s)
  | ts!!2 `isSuffixOf` s  = sol (take (length s-5) s)
  | ts!!3 `isSuffixOf` s  = sol (take (length s-6) s)
  | otherwise             = False

ts = ["dream","dreamer","erase","eraser"]