#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int i,j;
char a[3],t;
while(gets(a))
{
for(i=0; i<3; i++)
for(j=0;j<3-i-1;j++)
if(a[i]>a[i+1])
{
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
}
if(a[0]>a[1])
{
t=a[0];
a[0]=a[1];
a[1]=t;
}
for(i=0; i<2; i++)
cout<<a[i]<<" ";
cout<<a[2]<<endl;
}
return 0;
#include <cstdio>
using namespace std;
int main()
{
int i,j;
char a[3],t;
while(gets(a))
{
for(i=0; i<3; i++)
for(j=0;j<3-i-1;j++)
if(a[i]>a[i+1])
{
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
}
if(a[0]>a[1])
{
t=a[0];
a[0]=a[1];
a[1]=t;
}
for(i=0; i<2; i++)
cout<<a[i]<<" ";
cout<<a[2]<<endl;
}
return 0;
}
注意杭电ACM的OL很严格,有多余空格会PE!