#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int a[1000];
int ji[1000];
int ou[1000];
int main()
{
int count = 0;
char c;
do{
scanf("%d",a+count);
scanf("%c",&c);
count++;
}while(c!='\n');
int ji_n=0;
int ou_n=0;
for (int i = 0; i<count; i++)
{
if ((a[i]&1)==0)
ou[ou_n++] = a[i];
else
ji[ji_n++] = a[i];
}
sort(ji,ji+ji_n,greater<int>());
sort(ou,ou+ou_n);
for (int i = 0; i<ji_n; i++)
{
if (i == 0)
cout<<ji[i];
else
cout<<" "<<ji[i];
}
for (int i = 0; i<ou_n; i++)
{
if (i == 0&&ji_n==0)
cout<<ou[i];
else
cout<<" "<<ou[i];
}
}
网友评论