code
#include <iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
using namespace std;
#define x first
#define y second
string s;
unordered_map<char, int> map;
//1 排序 a在前 b在后 => 若满足,则返回true
bool cmp(const pair<char, int> &a, const pair<char, int> &b)
{
if(a.y == b.y && a.x < b.x || a.y > b.y) return true;
return false;
}
int main() {
cin >> s;
for(auto t : s){
map[t] ++;
}
//2 hashmap<type1, type2>(存储的是键值对)转为vector<pair<type1,type2>>数组 不用hashmap写cmp进行条件排序 换用熟悉的vector来进行
vector<pair<char, int> > count_vec(map.begin(), map.end());
//3 cmp的对象是 vector中的元素 类型是 pair<char, int>
sort(count_vec.begin(), count_vec.end(), cmp);
for(auto t : count_vec){
cout << t.first;
}
}