题解 | #统计字符#
统计字符
https://www.nowcoder.com/practice/539054b4c33b4776bc350155f7abd8f5
line = input() alpha, space, digit, other = 0, 0, 0, 0 for ch in line: if ch.isalpha(): alpha += 1 elif ch == ' ': space += 1 elif ch.isdigit(): digit += 1 else: other += 1 print(alpha) print(space) print(digit) print(other)