#include <iostream>
#include <string>
#include <vector>
using namespace std;
void Seperate (vector<int> & input);
int main(int argc, char* argv[])
{
vector<int> input;
cout<< "Enter the 10 numbers that you want to be seperated"<<endl;
for(int x=0;x<10;x++)
{
char y;
cin>> y;
input.push_back(y - '0');
}
Seperate(input);
for(int y=0;y<10;y++)
{
cout<< input[y];
}
return 0;
}
void Seperate (vector<int> &input)
{
string newvec;
int size;
size=input.size();
int start=0;
int end=size;
while (true) {
while ((start != end) && (input[start] % 2 == 0)) {
++start;
} //This part gets the even numbers.
if (start == end--) break; //Checks if we are done.
while ((start != end) && (input[end] % 2 != 0)) {
--end;
}
if (start == end) break;//Checks if we are done.
swap(input[start++], input[end]);
}
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgICNpbmNsdWRlIDxzdHJpbmc+CiAgICAjaW5jbHVkZSA8dmVjdG9yPgogICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDsKICAgIHZvaWQgU2VwZXJhdGUgKHZlY3RvcjxpbnQ+ICYgaW5wdXQpOwogICAgaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqIGFyZ3ZbXSkKICAgIHsKICAgIHZlY3RvcjxpbnQ+IGlucHV0OwogICAgY291dDw8ICJFbnRlciB0aGUgMTAgbnVtYmVycyB0aGF0IHlvdSB3YW50IHRvIGJlIHNlcGVyYXRlZCI8PGVuZGw7CiAgICBmb3IoaW50IHg9MDt4PDEwO3grKykKICAgIHsKICAgIGNoYXIgeTsKICAgIGNpbj4+IHk7CiAgICBpbnB1dC5wdXNoX2JhY2soeSAtICcwJyk7CiAgICB9CiAgICBTZXBlcmF0ZShpbnB1dCk7CiAgICBmb3IoaW50IHk9MDt5PDEwO3krKykKICAgIHsKICAgIGNvdXQ8PCBpbnB1dFt5XTsKICAgIH0KICAgICAKICAgIHJldHVybiAwOwogICAgfQogICAgIAogICAgdm9pZCBTZXBlcmF0ZSAodmVjdG9yPGludD4gJmlucHV0KQogICAgewogICAgc3RyaW5nIG5ld3Zl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