题解 | #图片整理#
图片整理
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; }