题解 | 图片整理
图片整理
https://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941
#include <stdio.h>
#include <stdlib.h>
int compare(const void *p, const void *q)
{
return (*(char *)p - *(char *)q);
}
int main()
{
char s[1010] = {0};
fgets(s, sizeof(s), stdin);
s[strcspn(s, "\n")] = '\0';
qsort(s, strlen(s), sizeof(s[0]), compare);
printf("%s\n", s);
return 0;
}


查看17道真题和解析