L1-003 个位数统计 python
python 实现
s=str(input()) lst_s=[] lst_info=[] lst_num=[] for i in s: if int(i) not in lst_info: lst_info.append(int(i)) lst_s.append(int(i)) lst_info.sort() for i,item in enumerate(lst_info): lst_num.append(lst_s.count(item)) for i,item in enumerate(lst_info): print("{index}:{num}".format(index=item,num=lst_num[i]))