sicily 1007. To and Fro
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int column,row,length,i,time;
char ch,list[100][20];
while(scanf("%d",&column),column)
{
scanf("\n");
length=i=0;
while(scanf("%c",&ch),ch!='\n')
{
length++;
list[(length-1)/column][i++]=ch;
i=i%column;
}
row=length/column;
for(time=0;time<column;time++)
for(i=0;i<row;i++)
if(i%2)
cout<<list[i][column-time-1];
else
cout<<list[i][time];
printf("\n");
}
return 0;
}