Monday, April 25, 2016

UVA 11192 : Group Reverse -Solution

Unknown
#include<cstdio>
#include<string.h>
using namespace std;

int main()
{
    int g;
    while (scanf("%d",&g)==1)
    {
        if (g==0) break;
        char s[110];
        getchar();
        scanf("%s",s);
        int l=strlen(s);
        int nchar=l/g;
        for (int i=1;i<=g;i++)
        {
            int j=i*nchar;
            int t=nchar;
            while (t--) printf("%c",s[--j]);
        }
        printf("\n");
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,