-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTOANDPRO.c
More file actions
42 lines (41 loc) · 727 Bytes
/
Copy pathTOANDPRO.c
File metadata and controls
42 lines (41 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<stdio.h>
#include<string.h>
int main()
{
char a[200];
int n,len,b[200],c,d,i,j,dt;
while(1)
{
scanf("%d",&n);
if(n==0)
break;
scanf("%s",a);
len=strlen(a);
d=len/n;
for(i=0,j=0;i<len-n;j++)
{
b[j]=i;
if(i%2==0)
i+=n*2-1;
else
i++;
}
b[j]=i;
dt=n;
while(dt>0)
{
for(i=0;i<d;i++)
{
c=b[i];
printf("%c",a[c]);
if(i%2==0)
b[i]+=1;
else
b[i]-=1;
}
dt--;
}
printf("\n");
}
return 0;
}