#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++)
{
int y;
cin>> y;
input.push_back(y);
}
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]);
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp2b2lkIFNlcGVyYXRlICh2ZWN0b3I8aW50PiAmIGlucHV0KTsKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqIGFyZ3ZbXSkKewoJdmVjdG9yPGludD4gaW5wdXQ7Cgljb3V0PDwgIkVudGVyIHRoZSAxMCBudW1iZXJzIHRoYXQgeW91IHdhbnQgdG8gYmUgc2VwZXJhdGVkIjw8ZW5kbDsKCWZvcihpbnQgeD0wO3g8MTA7eCsrKQoJewoJCWludCB5OwoJCWNpbj4+IHk7CgkJaW5wdXQucHVzaF9iYWNrKHkpOwoJfQoJU2VwZXJhdGUoaW5wdXQpOwoJZm9yKGludCB5PTA7eTwxMDt5KyspCgl7CgkJY291dDw8IGlucHV0W3ldOwoJfQoKCXJldHVybiAwOwp9Cgp2b2lkIFNlcGVyYXRlICh2ZWN0b3I8aW50PiAmaW5wdXQpCnsKCXN0cmluZyBuZXd2ZWM7CglpbnQgc2l6ZTsKCXNpemU9aW5wdXQuc2l6ZSgpOwoJaW50IHN0YXJ0PTA7CglpbnQgZW5kPXNpemU7Cgkgd2hpbGUgKHRydWUpIH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