关于C++英文统计
英文里出现最频繁的字母是小写e。你希望统计一下,在一段英文文章里出现最频繁的双字母组合和三字母组合是什么?
输入样例#1:
Talk is cheap. Show me the code. Good design adds value faster than it adds cost. In theory, theory and practice are the same. In practice, they're not. Debugging is twice as hard as writing the code in the first place.
输出样例#1:
he
the
```c++
#include <bits/stdc++.h>
using namespace std;
map<string,int>d;
int main()
{
string s,ans;
int big=0;
while(cin>>s)
{
d[s]++;
}
map<string,int>::iterator mit;
for (mit=d.begin();mit!=d.end();mit++)
{
int cnt=mit->second;
if (cnt>big)
{
big=cnt;
ans=mit->first;
}
else if(cnt==big)
{
if (mit->first<ans)
{
ans=mit->first;
}
}
}
cout<<ans<<endl;
return 0;
}
```