//用lambda
void Sortbytimes(vector<int> A)
{
int len =
A.size();
map<int, int> res;
for (int i = 0;i <
len;i++)
{
auto ret = res.insert({ A[i],1 });
if
(ret.second == false)
res[A[i]]++;
}
stable_sort(A.begin(), A.end(), [res](const int& a, const
int& b) {return res.at(a)>res.at(b);});;
for (auto a :
A)
cout << a << " ";
}