#include #include #include using namespace std; int main() { vector arr; int num; // Read input until end-of-file (EOF) while (cin >> num) { arr.push_back(num); } if (arr.empty()) { cout << "0" << endl; return 0; } vector odd, even; // Split the array into odd and even numbers for (size_t i = 0; i < arr.size(); i++) { if (arr[i] % 2 == 0) { even.push_back(arr[i]); } else { odd.push_back(arr[i]); } } // Sort the odd and even arrays sort(odd.begin(), odd.end()); sort(even.begin(), even.end()); // Output the sorted odd numbers for (size_t i = 0; i < odd.size(); i++) { cout << odd[i] << (i == odd.size() - 1 ? "\n" : " "); } // Output the sorted even numbers for (size_t i = 0; i < even.size(); i++) { cout << even[i] << (i == even.size() - 1 ? "\n" : " "); } return 0; }