main :: IO()
main = do
    str <- getLine
    putStrLn $ if getsolve (reverse str) then "YES" else "NO"

getsolve "" = True
getsolve ('m':'a':'e':'r':'d':ls) = getsolve ls
getsolve ('r':'e':'m':'a':'e':'r':'d':ls) = getsolve ls
getsolve ('e':'s':'a':'r':'e':ls) = getsolve ls
getsolve ('r':'e':'s':'a':'r':'e':ls) = getsolve ls
getsolve _ = False







