import re s=[] while 1: try:s+=re.sub("[^a-z\s]","",raw_input().lower()).split() except: break for i in sorted(set(s)): print "%s %s"%(s.count(i), i)