1456. Maximum Number of Vowels in a Substring of Given Length

class Solution:
    def maxVowels(self, s: str, k: int) -> int:
        vowels = 'aeiou'
        s += "*"
        count = 0
        for i in range(k):
            e = s[i]
            if e in vowels:
                count += 1
        a = 0
        b = k - 1
        ans = 0
        while b < len(s) - 1:
            if count > ans:
                ans = count
            if s[a] in vowels:
                count -= 1

            b += 1
            a += 1
            if s[b] in vowels:
                count += 1

        return ans