import sys,re C={} for L in sys.stdin: for W in re.sub(r"[^ a-z]","",L.lower()).split():C[W]=C.get(W,0)+1 for W in sorted(C.keys()):print C[W],W