jfz-2023-s473616/TaskF02/run.py

24 lines
791 B
Python
Raw Permalink Normal View History

2024-01-21 21:43:56 +01:00
import re
def count_characters(category, line):
return len(re.findall(category, line))
if __name__ == "__main__":
while True:
try:
line = input()
if not line:
break
# Zliczanie małych liter, dużych liter, cyfr i pozostałych znaków osobno
lowercase_count = count_characters(r'[a-ząćęłńóśźż]', line)
uppercase_count = count_characters(r'[A-ZĄĆĘŁŃÓŚŹŻ]', line)
digit_count = count_characters(r'\d', line)
other_count = count_characters(r'[^a-ząćęłńóśźżA-ZĄĆĘŁŃÓŚŹŻ\d]', line)
result = f"{lowercase_count} {uppercase_count} {digit_count} {other_count}"
print(result)
except EOFError:
break