import Data.List (groupBy)
longest :: String -> Int
longest = maximum . map length . filter (isVowel . head) . groupBy bothVowels
bothVowels a b = (isVowel a) && (isVowel b)
isVowel :: Char -> Bool
isVowel = (flip elem) "aeiou"
longest "codewarriors" -- 2
I could have done it with a single fold, but I decided to group the characters by groups of vowels and non-vowels, filter out the groups that are not vowels, map the length of each group and pick the largest number.
Also, almost entirely point-free, a pity I couldn't figure out how to make bothVowels point-free.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.