题解 | 统计字符
统计字符
https://www.nowcoder.com/practice/539054b4c33b4776bc350155f7abd8f5
a = input() n = len(a) cnt1,cnt2,cnt3,cnt4=0,0,0,0 for i in range(n): temp = ord(a[i]) if 65<=temp<=90 or 97<=temp<=122: cnt1 += 1 elif temp == 32: cnt2 += 1 elif 48<=temp<=57: cnt3 += 1 else: cnt4+= 1 print(cnt1,cnt2,cnt3,cnt4,sep="\n")