a=''.join(x for x in open('/dev/fd/0').read().lower()if"`"x).split() for i in sorted(set(a)):print a.count(i),i