#include <stdio.h>
const int N = 1000000;
char ch[N];
int main(){
gets(ch);
int count[127]={0};
for(int i=0; ch[i]; i++) count[ch[i]]++;
int max = -1;
char c;
int sum = 0;
for(int i=0; i<127; i++){
if(count[i] > max){
max = count[i];
c = (char)i;
}
}
for(int i = 0;ch[i]!='\0';i++){
if(ch[i] == c) sum++;
}
printf("%c\n", c);
printf("%d",sum);
return 0;
}