solve :: String -> Bool
solve xs 
    | length xs <= 7 = elem xs ["dream","dreamer","erase","eraser"]
    | (take 7 xs) == "dreamer" = or [solve (drop 5 xs),solve (drop 7 xs)]
    | (take 6 xs) == "eraser" = solve (drop 6 xs)
    | (take 5 xs) == "dream" = solve (drop 5 xs)
    | (take 5 xs) == "erase" = solve (drop 5 xs)
    | otherwise = False
solve' xs = (if solve xs then "YES" else "NO")

main = do
    ss <- solve' <$> getLine
    putStrLn ss