str1 = input() dict1 = {} for i in str1: try: i = i.lower() if i not in dict1.keys() and "a"<=i<="z": dict1[i] = 1 else: dict1[i] = dict1[i] + 1 except: pass list1 = sorted(dict1.items(),key=lambda a:(-a[1],a[0])) print(list1[0][0],list1[0][1])
python 1042 字符统计 (20 分)
猜你喜欢
转载自blog.csdn.net/weixin_41775301/article/details/87450772
今日推荐
周排行