【POJ】Symmetric Order


Problem here
Solution
#include 
#include 
#include 
using namespace std;

vector<string> strs;
int n, cnt = 0;

void solve(int a, int b){
    if(b == strs.size() || a == strs.size())
        return;

    cout << strs[a] << endl;
    solve(a+2, b+2);
    if(strs[b] != " ")
        cout << strs[b] << endl;
}

int main(){
    while(cin >> n){
        strs.clear();
        if(n == 0)
            break;
        for(int i = 0; i < n; i++){
            string input;
            cin >> input;
            strs.push_back(input);
        }
        cout << "SET " << ++cnt << endl;
        if(n%2!=0)
            strs.push_back(" ");
        solve(0,1);

    }

    return 0;
}