题解 | #字符统计#

字符统计

https://www.nowcoder.com/practice/c1f9561de1e240099bdb904765da9ad0

#include <iostream>
#include <map>
using namespace std;

int main() {
    string s;
    string s0;
    cin >> s;
    map<char,int> l;
    map<int,string> q;
    for(auto e : s){
        l[e]++;
    }
    for(auto e : l){
        q[e.second].push_back(e.first);
    }
    for(auto e : q){
        s0 = e.second + s0;
    }
    cout << s0 << endl;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

头像
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务