240 发简信
IP属地:江苏
  • #include <bits/stdc++.h>
    using namespace std;
    int main(){
    string s;
    set <char> tp;//出现的字符
    set <char>::iterator it;
    map<char,int> aa; //对应字符出现的次数
    cin>>s;
    getchar();
    for(int i=0;i<s.length();i++){
    tp.insert(s[i]);
    }
    for(int i=0;i<s.length();i++){
    aa[s[i]]+=1;
    }
    it=tp.begin();
    int max=aa[*it];
    char f='a';
    for(it=tp.begin();it!=tp.end();it++){
    if(aa[*it]>max)
    {
    max=aa[*it];
    f=*it;
    }
    }
    cout<<f<<endl;
    cout<<max<<endl;
    return 0;
    }

    试题 历届试题 单词分析(C语言)

    资源限制时间限制:1.0s 内存限制:256.0MB 问题描述小蓝正在学习一门神奇的语言,这门语言中的单词都是由小写英文字母组成,有些单词很长,远远超过正常英文单词的长度...