Loading... **蓝桥杯无法使用`for(x : y){}` 、 `auto`等的C11语法和关键字** ``` #include<bits/stdc++.h> using namespace std; map<char, int> m; int main(void){ string str; char mc; int s = 0; for(int i = 97; i <= 122; i++){ m.insert(make_pair((char)i, 0)); } cin >> str; for(int i = 0; i < str.size(); i++){ m[str[i]]++; } for(map<char, int>::iterator i = m.begin(); i != m.end(); i++){ if(s < i->second) mc = i->first, s = i->second; // 记录次数 } cout << mc << endl << m[mc]; return 0; } ``` Last modification:March 27, 2022 © Allow specification reprint Like 0 如果觉得我的文章对你有用,请随意赞赏
Comment here is closed