jfz-2023-s464983/TaskF03/run.py

14 lines
445 B
Python

import re
def count(file_path):
lowercase= r'\b[a-ząćęłńóśźż]\w*'
uppercase = r'\b[A-ZĄĆĘŁŃÓŚŹŻ]\w*'
with open(file_path, 'r', encoding='utf-8') as file:
for line in file:
lowercase_count = len(re.findall(lowercase, line))
uppercase_count = len(re.findall(uppercase, line))
print(f"{lowercase_count} {uppercase_count}")
file_path = 'TaskF03/simple.in'
count(file_path)