import Data.List
main = getLine >>= putStrLn . cvt . solve
    where
        cvt b
            | b = "YES"
            | otherwise = "NO"

solve :: String -> Bool
solve ('d' : 'r' : 'e' : 'a' : 'm' : rs)
    | "era" `isPrefixOf` rs = solve rs
    | "er" `isPrefixOf` rs = solve $ drop 2 rs
    | otherwise = solve rs
solve ('e' : 'r' : 'a' : 's' : 'e' : rs) = solve rs'
    where
        rs'
            | "r" `isPrefixOf` rs = tail rs
            | otherwise = rs
solve (_ : _) = False
solve _ = True
