案例可能有多组,每个案例输入为一行字符串。
对每个案例按A-Z的顺序输出其中大写字母出现的次数。
DFJEIWFNQLEF0395823048+_+JDLSFJDLSJFKK
A:0 B:0 C:0 D:3 E:2 F:5 G:0 H:0 I:1 J:4 K:2 L:3 M:0 N:1 O:0 P:0 Q:1 R:0 S:2 T:0 U:0 V:0 W:1 X:0 Y:0 Z:0
from collections import Counter from string import ascii_uppercase as a try: while 1: L = Counter(filter(lambda x:x.isupper() is True, raw_input())) for i in a: print i + ':' + str(L[i]) if i in a else i + ':' + '0' except: pass