#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int hashTable[26];
int main(){
string str;
getline(cin, str);
int len = str.length();
for(int i = 0; i < len; i++){
if(str[i] >= 'a' && str[i] <= 'z'){
int a = str[i] - 'a';
hashTable[a]++;
}
if(str[i] >= 'A' && str[i] <= 'Z'){
int a = str[i] - 'A';
hashTable[a]++;
}
}
int num = 0;
int index = 0;
for(int i = 0; i < 26; i++){
if(hashTable[i] > num){
index = i;
num = hashTable[i];
}
}
printf("%c %d", 'a'+index, num);
}