{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}

main :: IO ()
main = putStrLn =<< solve <$> getLine


solve :: String -> String
solve s
    | solve' s  = "YES"
    | otherwise = "NO"

solve' :: String -> Bool
solve' s = solve'' s tns where
    ts = ["dreameraser", "dreamerase", "dreamer",
          "dream", "eraser", "erase"]
    ns = map length ts
    tns = zip ts ns

solve'' :: String -> [(String, Int)] -> Bool
solve'' "" _ = True
solve'' s tns = any (match s tns) tns



match :: String -> [(String, Int)] -> (String, Int) -> Bool
match s tns (t, n)
    | take n s == t = solve'' (drop n s) tns
    | otherwise     = False where
