#include <iostream>
#include <cstring>
using namespace std;
int main(){
string str;
int a[200] = {0};
// cin >> str;
getline(cin, str);
for(int i = 0; i < str.length(); i++){
if(str[i] >= 'a' && str[i] <= 'z')
a[str[i]]++;
if(str[i] >= 'A' && str[i] <= 'Z')
a[str[i] + 32]++;
}
int max = 90;
for(int i = 'a'; i <= 'z'; i++)
if(a[max] < a[i])
max = i;
cout << (char)max << " " << a[max];
return 0;
}