09/07/07 18:31:32
>>733
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int compare(char x, char y)
{
if (isdigit(x)) return isdigit(y)? y - x: 1;
if (isupper(x)) return isdigit(y)? -1: isupper(y)? y - x: 1;
if (islower(x)) return isdigit(y) || isupper(y)? -1: islower(y)? y - x: 1;
return 0;
}
void bsort(char *str)
{
int i, j;
for (i = 0; i < strlen(str) - 1; ++i) {
for (j = 1; j < strlen(str) - i; ++j) {
if (compare(str[j], str[j - 1]) > 0) {
char t; t = str[j]; str[j] = str[j - 1]; str[j - 1] = t;
}
}
}
}
int main(void)
{
char str[128];
scanf("%s", str);
bsort(str);
puts(str);
return 0;
}