#include <iostream>

void rearrangeArray(int* arr, int size) {
    int* positiveArr = new int[size];
    int* negativeArr = new int[size];
    int positiveCount = 0;
    int negativeCount = 0;

    for (int i = 0; i < size; ++i) {
        if (arr[i] >= 0) {
            positiveArr[positiveCount++] = arr[i];
        } else {
            negativeArr[negativeCount++] = arr[i];
        }
    }

    for (int i = 0; i < positiveCount; ++i) {
        arr[i] = positiveArr[i];
    }

    for (int i = 0; i < negativeCount; ++i) {
        arr[positiveCount + i] = negativeArr[i];
    }

    delete[] positiveArr;
    delete[] negativeArr;
}

int main() {
    int arr[] = {-12, 11, -13, -5, 6, -7, 5, -3, -8};
    int size = sizeof(arr) / sizeof(arr[0]);

    rearrangeArray(arr, size);

    std::cout << "{";
    for (int i = 0; i < size; ++i) {
        std::cout << arr[i];
        if (i < size - 1) {
            std::cout << ", ";
        }
    }
    std::cout << "}" << std::endl;

    return 0;
}

