#include<stdio.h>
int main(){
char max,mid,min;
char a,b,c;
while(scanf("%c%c%c",&a,&b,&c)!=EOF){
getchar();//取回车字符
if(a>b){
if(a>c){
max=a;
mid=(b>c)?b:c;
min=(b<c)?b:c;
}
else{
max=c;
mid=a;
min=b;
}
}
else{
if(a>c){
max=b;
mid=a;
min=c;
}
else{
max=(b>c)?b:c;
mid=(b<c)?b:c;
min=a;
}
}
printf("%c %c %c\n",min,mid,max);
}
return 0;
}
【转】网上代码参考:http://blog.sina.com.cn/s/blog_6fb54b980100n3pn.html