哈希表
key存放字母对应的ASCII码
value存放个数
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <unordered_map>
using namespace std;
const int N = 1010;
unordered_map<int, int> h;
string a;
int main()
{
cin >> a;
for(int i=0; i<a.size(); i++)
{
auto x = h.find((int)a[i]);
if(x != h.end())
x->second++;
else
h[(int)a[i]] = 1;
}
int cnt = 0, res = 0;
for(auto x : h)
{
if(x.second > res)
{
res = x.second;
cnt = x.first;
}
else if(x.second == res && x.first < cnt)
cnt = x.first;
}
cout << char(cnt) << endl << res << endl;
return 0;
}