import re import sys def check(line): A = len(re.findall(r'\b[a-ząćęłńóśźż]\w*\b', line)) B = len(re.findall(r'\b[A-ZĄĆĘŁŃÓŚŹŻ]\w*\b', line)) return "{} {}".format(A, B) for line in sys.stdin: print(check(line))