题解 | #图片整理#__huawei_no.34-2

图片整理

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

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

int main() {
    string str;
    getline(cin, str);
    for (int i = 0; i < str.size(); i++) {
        for (int j = 0; j < str.size() - 1; j++) {
            if ( (str[j] ) > (str[j + 1])) {
                swap(str[j], str[j + 1]);
            }
        }
    }

    cout << str << endl;
    return 0;

}
// 64 位输出请用 printf("%lld")

直接冒泡排序来一波

全部评论

相关推荐

10-17 23:18
已编辑
西北农林科技大学 Web前端
独行m:给25可以试试,但他只能给12,那就是纯纯的事精
秋招,不懂就问
点赞 评论 收藏
分享
09-21 21:14
门头沟学院
否极泰来来来来:和他说:这里不好骂你,我们加个微信聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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