s = input().lower()
s =s.replace('.','').replace(',','').split()
d = {}
for i in s:
if i in d:
d[i]+=1
else :
d[i]=1
list1 = []
for k,v in d.items():
t = [k,v]
list1.append(t)
for i in range(len(list1)):
for j in range(i+1,len(list1)):
if list1[i][1]<list1[j][1]: list1[i],list1[j]=list1[j],list1[i]
elif list1[i][1]==list1[j][1] and list1[i][0]>list1[j][0]: list1[i],list1[j]=list1[j],list1[i]
for i in list1:
print(i[0],i[1])
沒有留言:
張貼留言