import Data.Bool
import Data.List

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

sol s
  | null s                = True
  | ts!!1 `isPrefixOf` s  = sol (s \\ ts!!0) || sol (s \\ ts!!1)
  | ts!!3 `isPrefixOf` s  = sol (s \\ ts!!2) || sol (s \\ ts!!3)
  | ts!!0 `isPrefixOf` s  = sol (s \\ ts!!0)
  | ts!!2 `isPrefixOf` s  = sol (s \\ ts!!2)
  | otherwise             = False

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