题解 | #图片整理#

图片整理

http://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941

#include <bits/stdc++.h>
#include <iostream>
#include <string>

using namespace std;

struct cmp{
    bool operator()(char& a, char& b){
        return a < b; //前面小后面大 升序
    }  
};

int main(){
    string str = "";
    getline(cin, str);

    sort(str.begin(), str.end(), cmp());
    
    cout << str << endl;
    
    return 0;
}
华为题库题解 文章被收录于专栏

牛客华为题库的题解

全部评论

相关推荐

02-25 13:02
中南大学 C++
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务