#学习的知识:
#一定要使用while True和try except
#split('\\')
#对字典的值从大到小进行排序:dic1=dict(sorted(dic.items(),key=lambda item:item[1],reverse=True))
#' '.join(list1)将列表内的各个string合并成一个大string
dic={}
while True:
try:
line=input()
if not line:
break
else:
line=line.split('\\')
line1=line[-1]
if line1 in dic:
dic[line1]=dic[line1]+1
else:
dic[line1]=1
except:
break
dic1=dict(sorted(dic.items(),key=lambda item:item[1],reverse=True))
c=0
for x in dic1:
if c<8:
c=c+1
file1=x.split(' ')
if len(file1[0])>16:
list1=[file1[0][-16:]]+file1[1:]
print(' '.join(list1),dic[x])
else:
print(x,dic[x])