Tuesday 8 May 2012

UVa 11192 Group Reverse Solution

#include<stdio.h>
#include<string.h>
int main()
{
int i,j,l,d,a,n;
char s[1000];
while(scanf("%d",&n)==1)
{
if(n==0) break;
scanf(" ");
gets(s);
l=strlen(s);
d=l/n;
for(i=1;i<=n;i++)
{
a=i*d;
for(j=a-1;j>=a-d;j--)
printf("%c",s[j]);
}
printf("\n");
}
}


2 comments:

  1. plzzz,,tell me ,,whats the use of scanf(" ") in hear

    ReplyDelete
    Replies
    1. See the input
      Scanf(" ")used to read the space

      Delete