main :: IO () 
main = do
    text <- getLine
    let reversed = reverse text
    if execDreamer' reversed
        then putStrLn "YES"
        else putStrLn "NO"

execDreamer' :: String -> Bool
execDreamer' "" = True
execDreamer' ('m':'a':'e':'r':'d':xs) = execDreamer' xs
execDreamer' ('r':'e':'m':'a':'e':'r':'d':xs) = execDreamer' xs
execDreamer' ('e':'s':'a':'r':'e':xs) = execDreamer' xs
execDreamer' ('r':'e':'s':'a':'r':'e':xs) = execDreamer' xs
execDreamer' _ = False