import re def my_func(in_str): alphabet = len(re.findall("[a-zA-Z]+?", in_str)) white_space = len(re.findall("\s+?", in_str)) numbers = len(re.findall("[0-9]+?", in_str)) others = len(list(in_str)) - alphabet - white_space - numbers print(alphabet, white_space, numbers, others, sep="\n") while True: try: my_func(input()) except (EOFError, KeyboardInterrupt): break