djfz-2020-s450026/TaskD02/D02.py

14 lines
419 B
Python
Raw Normal View History

2020-12-06 23:49:28 +01:00
import re
import sys
def count_chars(string):
lower = len(re.findall(r"[a-ząćęłńóśźż]", string))
capital = len(re.findall(r"[A-ZĄĆĘŁŃÓŚŹŻ]", string))
digit = len(re.findall(r"[0-9]", string))
rest = len(string) - lower - capital - digit
return str(lower) + " " + str(capital) + " " + str(digit) + " " + str(rest)
for line in sys.stdin:
print(count_chars(line.rstrip("\n")))