x=input()
count=1
for i in x:
	c=x.count(i)
	if c>count:
    	count=c
		s=i
	print(s,c)