#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
map<char, int> m;
for (int i = 0; s[i]; i++)
{
m[s[i]]++;
}
char ac = 'a';
int am = 0;
for (char c = 'a'; c <= 'z'; c++)
{
if (m[c] > am)
{
am = m[c];
ac = c;
}
}
cout << ac << " " << am;
return 0;
}