aboutsummaryrefslogtreecommitdiff
path: root/challenge-332/sgreen/python/ch-2.py
blob: 8a59970f3779d7ece5ce84c11ee9207767b4af40 (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
#!/usr/bin/env python3

import sys
from collections import Counter


def odd_letters(input_string: str) -> bool:
    """
    Check if all letters in the input string have an odd frequency.

    Args:
        input_string (str): The input string to check.
    Returns:
        bool: True if all letters have an odd frequency, False otherwise.
    """

    freq = Counter(input_string)
    return all(count % 2 == 1 for count in freq.values())


def main():
    result = odd_letters(sys.argv[1])
    print(result)


if __name__ == '__main__':
    main()