while True: try: raw_str = input() res_dic = {"Char": 0, "Space": 0, "Digit": 0, "Other": 0} for c in raw_str: if c.isalpha(): res_dic["Char"] += 1 elif c.isspace(): ...