题解 | 图片整理
#include <stdio.h>
#include <string.h>
int main() {
char s[1001];
scanf("%s", s);
int len = strlen(s);
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len - i - 1; j++)
{
if (s[j] > s[j + 1])
{
char temp = s[j];
s[j] = s[j + 1];
s[j + 1] = temp;
}
}
}
printf("%s", s);
return 0;
}
查看14道真题和解析
