blob: dcc826b062e064bd4d03f20d16b886f32e507dfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/env python3
import sys
def count_vowels(s: str) -> int:
vowels = 'aeiouAEIOU'
return sum(1 for char in s if char in vowels)
def string_alike(input_string: str) -> bool:
# Ensure the input string is of even length
if len(input_string) % 2 == 1:
raise ValueError("Input string must have an even length.")
if count_vowels(input_string) == 0:
return False
# Split the string into two halves, and count vowels in each half
first_half = input_string[:len(input_string)//2]
second_half = input_string[len(input_string)//2:]
return count_vowels(first_half) == count_vowels(second_half)
def main():
result = string_alike(sys.argv[1])
print(result)
if __name__ == '__main__':
main()
|