第三号测试点过不去,不知道什么原因。
#include <map>
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
string s;
map<string, int> ma;
while(cin >> s){
string ans = "";
for(int i = 0; i < s.length(); i++)
if(isalnum(s[i])) ans += tolower(s[i]);
if(ans.length() != 0) ma[ans]++;
char ch = getchar();
if(ch == '\n') break;
}
int max = 0;
string ans = "";
for(auto it:ma){
if(it.second > max){
ans = it.first; max = it.second;
}
}
cout << ans << " " << max << endl;
return 0;
}