import re,sys f={} for w in re.sub('[^a-z ]','',sys.stdin.read().lower()).split():f[w]=f.setdefault(w,0)+1 for k in sorted(f.keys()):print f[k],k