#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
string s;
getline(cin, s);
map<string, int>count;
int i;
string str;
for (i = 0; i <= s.length(); i++)
{
if (s[i] <= '9'&&s[i] >= '0' || s[i] <= 'z'&&s[i] >= 'a')
str += s[i];
else if (s[i] <= 'Z'&&s[i] >= 'A')
str += s[i] - 'A' + 'a';
else
{
if (str.length() == 0)continue;
if (count.find(str) != count.end())
count[str]++;
else
count[str] = 1;
str.erase(str.begin(), str.end());
}
}
string maxindex;
int max = -1;
for (map<string, int>::iterator it = count.begin(); it != count.end(); it++)
{
if (it->second > max)
{
maxindex = it->first;
max = it->second;
}
}
cout << maxindex << " " << max;
system("pause");
return 0;
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-16322.html