#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
using namespace std;
map<string,int> mp;
bool pd(char c)
{
if(isdigit(c))
return true;
else if(c>='a'&&c<='z')
return true;
else if(c>='A'&&c<='Z')
return true;
else
return false;
}
int main()
{
string s;
getline(cin,s);
int i=0;
while(i<s.length())
{
string word;
while(i<s.length()&&pd(s[i]))
{
if(s[i]>='A'&&s[i]<='Z')
{
s[i]+=32;
}
word+=s[i];
i++;
}
if(word!="")
{
if(mp.find(word)==mp.end())
mp[word]=1;
else
mp[word]++;
}
while(i<s.length()&&pd(s[i])==false)
i++;
}
int maxn=0;
string str;
for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++)
{
if(it->second>maxn)
{
maxn=it->second;
str=it->first;
}
}
cout<<str<<" "<<maxn<<endl;
return 0;
}
熟练使用map与find函数