import re def count_types(file_path): lowercase_pattern = r'[a-ząćęłńóśźż]' uppercase_pattern = r'[A-ZĄĆĘŁŃÓŚŹŻ]' digit_pattern = r'\d' with open(file_path, 'r', encoding='utf-8') as file: for line in file: a = len(re.findall(lowercase_pattern, line)) b = len(re.findall(uppercase_pattern, line)) c = len(re.findall(digit_pattern, line)) d = len(line) - a - b - c - line.count('\n') print(f"{a} {b} {c} {d}") file_path = 'TaskF02/simple.in' count_types(file_path)