#include <stdio.h>
#include <string.h>
int main()
{
FILE *fin = fopen("input.txt", "r");
FILE *fout = fopen("output.txt", "w");
char s[1005];
fgets(s, 1000, fin);
int len = strlen(s);
// 先把所有非空格字符存到临时数组
char temp[1005];
int cnt = 0;
for (int i = 0; i < len; i++)
{
if (s[i] != ' ')
{
temp[cnt++] = s[i];
}
}
// 两两交换临时数组里的字符
for (int i = 0; i < cnt - 1; i += 2)
{
char t = temp[i];
temp[i] = temp[i + 1];
temp[i + 1] = t;
}
// 把交换后的字符回填原字符串,空格位置不变
int p = 0;
for (int i = 0; i < len; i++)
{
if (s[i] != ' ')
{
s[i] = temp[p++];
}
}
fprintf(fout, "%s", s);
fclose(fin);
fclose(fout);
return 0;
}