To and Fro
#include<iostream>
#include<string>
#include<fstream>
#include <string.h>
using namespace std;
int main(){
string shuru;
int column;
//ifstream ifs("shuju.txt");
while(cin>>column && column != 0){
cin>>shuru;
//ifs.ignore();
//getline(ifs, shuru);
char chongpai[105][25];
int jiOu;
int row = shuru.length() / column;
if(shuru.length() % column != 0){
row++;
}
if(row % 2 == 0){
jiOu = 0;
}else{
jiOu = 1;
}
int i;
int cishu;
cishu = row%2==0?(row/2):(row/2 + 1);
int j;
int k = 0;
for(j = 0; j < cishu; j++){
for(i = 0; i < column; i++){
chongpai[2 * j][i] = shuru[k];
k++;
}
i--;
if(j == cishu - 1){
if(jiOu == 1){
break;
}
}
for( ; i >= 0; i--){
chongpai[2 * j + 1][i] = shuru[k];
k++;
}
}
for(int m = 0; m < column; m++){
for(int n = 0; n < row; n++){
cout<<chongpai[n][m];
}
}
cout<<endl;
}
//system("pause");
return 0;
}