djfz-2023-s464933/TaskF02/run.py
2024-01-07 21:21:03 +01:00

41 lines
723 B
Python

import re
import sys
lowercasePattern = "[a-ząćęłńóśźż]"
uppercasePattern = "[A-ZĄĆĘŁŃÓŚŹŻ]"
digitPattern = "[0-9]"
def isUpperCase(inp: str):
return re.match(uppercasePattern, inp)
def isLowerCase(inp: str):
return re.match(lowercasePattern, inp)
def isDigit(inp: str):
return re.match(digitPattern, inp)
for line in sys.stdin:
line = line.strip('\n')
lower = 0
upper = 0
digits = 0
other = 0
for char in line:
if isLowerCase(char):
lower += 1
elif isUpperCase(char):
upper += 1
elif isDigit(char):
digits += 1
else:
other += 1
print(f"{lower} {upper} {digits} {other}")