from functools import cmp_to_key
def cmp(a,b):
if a[1]<b[1]:
return 1
elif a[1]>b[1]:
return -1
else:
if a[0]<b[0]:
return -1
elif a[0]>b[0]:
return 1
else:
return 0
s=input().lower()
re=['!','.',',',':','*','?']
dic={}
while s!='!!!!!':
for i in re:
s=s.replace(i," ")
s=s.split(" ")
for i in s:
if not len(i.strip()) :
continue
if i in dic.keys():
dic[i]+=1
else:
dic[i]=1
s=input().lower()
print(len(dic))
ls=sorted(dic.items(),key = cmp_to_key(cmp))
count=0
for i in ls:
if count<10:
print("%s=%s"%(i[0],i[1]))
count+=1