#include <stdio.h>
int main() {
int pos_arr[10]; // 存放正数的数组
int neg_arr[10]; // 存放负数的数组
int pos_count = 0;
int neg_count = 0;
int temp;
// 1. 循环读取 10 个整数并进行分类
for (int i = 0; i < 10; i++) {
scanf("%d", &temp);
if (temp > 0) {
pos_arr[pos_count] = temp;
pos_count++;
} else if (temp < 0) {
neg_arr[neg_count] = temp;
neg_count++;
}
// 如果 temp == 0,则什么都不做,直接忽略
}
// 2. 按格式输出结果:先正数后负数
int first = 1; // 用于控制空格的打印
// 打印正数
for (int i = 0; i < pos_count; i++) {
if (!first) {
printf(" ");
}
printf("%d", pos_arr[i]);
first = 0;
}
// 打印负数
for (int i = 0; i < neg_count; i++) {
if (!first) {
printf(" ");
}
printf("%d", neg_arr[i]);
first = 0;
}
printf("\n");
return 0;
}