1042 字符统计 (20 分)

水~。

map<char,int> mp;

int main()
{
    string s;
    getline(cin,s);

    for(auto t:s)
        if(isalpha(t))
            mp[tolower(t)]++;

    char c='a';
    for(auto t:mp)
        if(t.se > mp[c])
            c=t.fi;

    cout<<c<<' '<<mp[c]<<endl;
    //system("pause");
    return 0;
}
原文地址:https://www.cnblogs.com/fxh0707/p/14409490.html