解题思路:
注意事项:
需要一点Python进阶的基础
参考代码:
import collections sentence = list(input().strip().split()) temp, symbol = [], [',', '.'] for i in sentence: if i[-1] in symbol: temp.append(i[0:-1].upper()) else: temp.append(i.upper()) cnt = dict(collections.Counter(temp)) max_len = len(max(cnt, key=lambda x: len(x))) for i in cnt: print("{0:>{1:}}:{2:}{3:}".format(i, max_len, cnt[i] * '*', cnt[i]))
0.0分
0 人评分