#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <vector>
using namespace std;
void sort(vector<int>&a)
{
int temp = 0;
for (vector<int>::iterator i = a.begin(); i !=a.end(); i++)
{
for (vector<int>::iterator j = i; j != a.end(); j++)
{
if (*i>*j)
{
temp = *i;
*i = *j;
*j = temp;
}
}
}
}
int main()
{
int x;
vector<int> vint;
vector<int> vodd;
vector<int> veven;
//while(scanf_s("%d",&x)==1)
while (cin>>x)
{
vint.push_back(x);
if (getchar() == '\n')
break;
//cout << x <<" ";
}
for (vector<int>::iterator index = vint.begin(); index != vint.end(); ++index)
{
if ((*index) % 2 == 0)
{
veven.push_back(*index);
}
else
{
vodd.push_back(*index);
}
}
sort(veven);
sort(vodd);
for (vector<int>::iterator oddIndex = vodd.begin(); oddIndex != vodd.end(); ++oddIndex)
{
cout << *oddIndex << " ";//基数
}
cout << endl;
for (vector<int>::iterator evenIndex = veven.begin(); evenIndex != veven.end(); ++evenIndex)
{
cout << *evenIndex << " ";///偶数
}
cout << endl;
}
#include <string>
#include <cstring>
#include <math.h>
#include <vector>
using namespace std;
void sort(vector<int>&a)
{
int temp = 0;
for (vector<int>::iterator i = a.begin(); i !=a.end(); i++)
{
for (vector<int>::iterator j = i; j != a.end(); j++)
{
if (*i>*j)
{
temp = *i;
*i = *j;
*j = temp;
}
}
}
}
int main()
{
int x;
vector<int> vint;
vector<int> vodd;
vector<int> veven;
//while(scanf_s("%d",&x)==1)
while (cin>>x)
{
vint.push_back(x);
if (getchar() == '\n')
break;
//cout << x <<" ";
}
for (vector<int>::iterator index = vint.begin(); index != vint.end(); ++index)
{
if ((*index) % 2 == 0)
{
veven.push_back(*index);
}
else
{
vodd.push_back(*index);
}
}
sort(veven);
sort(vodd);
for (vector<int>::iterator oddIndex = vodd.begin(); oddIndex != vodd.end(); ++oddIndex)
{
cout << *oddIndex << " ";//基数
}
cout << endl;
for (vector<int>::iterator evenIndex = veven.begin(); evenIndex != veven.end(); ++evenIndex)
{
cout << *evenIndex << " ";///偶数
}
cout << endl;
}