#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void toandfro(int c,char b[])
{
char p[20][20];
int r=strlen(b),j,k,i;
float f=(float)r/c;
r=ceil(f);
// printf("%d %d",r,c);
j=0;
k=0;
for(i=0;i<r;i++)
{
if(j==0)
{
for(j=0;j<c;j++)
{
p[i][j]=b[k++];
// printf("%c",p[i][j]);
}
}
else
{
for(j=c-1;j>=0;j--)
{
p[i][j]=b[k++];
// printf("%c",p[i][j]);
}
j=0;
}
}
printf("\n");
for(i=0;i<c;i++)
{
for(j=0;j<r;j++)
{
printf("%c",p[j][i]);
}
}
}
main()
{
int a[10000],i,j,x;
char b[10000][201];
for(i=0;(scanf("%d",&x)==1)&&(x!=0);i++)
{
a[i]=x;
scanf("%s",b[i]);
}
for(j=0;j<i;j++)
{
// printf("%d %s....",a[j],b[j]);
toandfro(a[j],b[j]);
}
}
i got runtime error when submiting , i dono where the problem arises , pls help me out of this ....thanks in advance