#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 2e2+10;
int t,n,m,k,l,r,op,x,y;
int f[N];
bool flag;
char ch;
void solve(){
while(cin>>ch){
if(ch>='A'&&ch<='Z')ch+=32;
if(ch>='a'&&ch<='z')f[(int)ch]++;
}
int pos = max_element(f,f+N)-f;
cout<<(char)pos<<" "<<f[pos];
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}