题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/d2f088e655d44e4a85c16f7b99126211
#include<stdio.h> #include<string.h> int main(){ char str[100]; scanf("%s",str); for(int i=0;i<strlen(str)-1;i++) //冒泡法 for(int j=0;j<strlen(str)-1-i;j++) if(str[j]>str[j+1]){ char c =str[j]; str[j]=str[j+1]; str[j+1]=c; } puts(str); }