题解 | #图片整理#
图片整理
http://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941
#include <stdio.h>
#include <string.h>
static char g_string[1001] = {0};
int main(int argc, char** argv)
{
while (gets(g_string) != NULL) {
for (int i = 0; i < strlen(g_string) - 1; i++) {
for (int j = i + 1; j > 0; j--) {
if (g_string[j] >= g_string[j - 1]) break;
g_string[j] ^= g_string[j - 1] ^= g_string[j] ^= g_string[j - 1];
}
}
printf("%s\n", g_string);
}
return 0;
}