题解 | #图片整理#

图片整理

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

#include <stdio.h>
#include <string.h>
char str[1002];
int main() {
    fgets(str,1002,stdin);
    int len = strlen(str)-1;
    int low=0,fast=1;
    char tem='\0';

    while(str[low]!='\n')
    {
        if(str[fast]!='\n')
        {
            if(str[low]>str[fast])
            {
                tem=str[low];
                str[low] = str[fast];
                str[fast] = tem;
            } else {
                fast++;
            }
        } else {
            low++;
            fast=low+1;
        }
    }
    printf("%s",str);
    return 0;
}

全部评论

相关推荐

强大的马里奥:不太可能,我校计算机硕士就业率99%
点赞 评论 收藏
分享
06-28 22:48
已编辑
广东金融学院 Java
小浪_Coding:学院本+这俩项目不是buff叠满了嘛
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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