原题链接
附代码:
#include<stdio.h>
int main()
{
char a, b, c;
while(scanf("%c%c%c",&a,&b,&c) != EOF)
{
getchar();
char temp;
if(a > b) /*使得a<=b*/
{
temp = a;
a = b;
b = temp;
}
if(a > c) /*使得a<=c*/
{
temp = a;
a = c;
c = temp;
}
if(b > c) /*使得b<=c*/
{
temp = b;
b = c;
c = temp;
}
/*注意:以上3个判断语句不能颠倒,否则就错了,原因是同时满足a<=b<=c*/
printf("%c %c %c\n",a, b, c);
}
}