
solve [] = "YES"
solve s
  | take 5 s == reverse "dream" = solve $ drop 5 s
  | take 7 s == reverse "dreamer" = solve $ drop 7 s
  | take 5 s == reverse "erase" = solve $ drop 5 s
  | take 6 s == reverse "eraser" = solve $ drop 6 s
  | otherwise = "NO"

main = do
  s <- getLine :: IO String
  putStrLn $ solve (reverse s)
