wordsparser::String ->Bool
wordsparser [] = True
wordsparser cs
      | take 5 cs == "dream" = wordsparser (drop 5 cs)
      | take 5 cs == "erase" = wordsparser (drop 5 cs)
      | take 6 cs == "eraser" = wordsparser (drop 6 cs)
      | take 7 cs == "dreamer" = wordsparser (drop 7 cs)

main::IO()
main =do
  dat<-getLine
  putStr ((if wordsparser dat then "YES" else "NO")++"\n")
