word = input()
count = dict()
for _ in word:
count[] = count.get(, 0) + 1
keys = list(count.keys())
values = list(count.values())
ans = []
M = max(values)
for i in range(len(values)):
if M == values[i]:
ans.append(keys[i])
print(min(ans))
print(M)