#include <stdio.h>
#include "string.h"
int main()
{
char s[20];
scanf("%s",s);
int i = 0;
int j = 0;
for (i = 0; i < 19; i++) {
int m = i;
for (j = i + 1; j < 20; j++) {
if (s[m] > s[j]) {
m = j;
}
}
int t = s[i];
s[i] = s[m];
s[m] = t;
}
for (i = 0; i < 20; i++)
printf("%c", s[i]);
return 0;
}
运行结果
用strlen运行结果
我想达到的目的