#include<stdio.h>
#include<string.h>
int main()
{
char str[1010];
int word[25]={0,};
int j=0;
gets(str);
int l=strlen(str);
int i;
for(i=0;i<l;i++)
{
if((str[i]<='Z'&&str[i]>='A')||(str[i]<='z'&&str[i]>='a'))
{
if(str[i]<='Z'&&str[i]>='A')
word[str[i]-'A'+1]++;
else
word[str[i]-'a'+1]++;
}
}
int temp=0;
for(i=1;i<=24;i++)
if(temp<word[i])
temp=word[i];
for(i=1;i<=24;i++)
{
if(temp==word[i])
{
printf("%c ",i+'a'-1);
break;
}
}
printf("%d",temp);
return 0;
}