# 1704. Determine if String Halves Are Alike ###### tags: `Leetcode` `Easy` Link: https://leetcode.com/problems/determine-if-string-halves-are-alike/description/ ## Code ```python= class Solution: def halvesAreAlike(self, s: str) -> bool: firstCnt, secondCnt = 0, 0 vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'} for i in range(len(s)//2): if s[i] in vowels: firstCnt += 1 for i in range(len(s)//2, len(s)): if s[i] in vowels: secondCnt += 1 return firstCnt==secondCnt ```