re: Daily Challenge #80 - Longest Vowel Change VIEW POST

FULL DISCUSSION
 

This is the Swift version :)

func longestVowelSubstring(s: String) -> Int {
    let vowels: [Character] = ["a", "e", "i", "o", "u"]
    var max = 0
    var aux = 0

    for (_,char) in s.enumerated() {
        if (vowels.contains(char)) {
            aux += 1
            max = max < aux ? aux : max
        } else {
            aux = 0
        }
    }

    return max
}
code of conduct - report abuse