Sunday, June 5, 2016

uva 490 - Rotating Sentences - solution

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

int main()
{
    char s[105][105];
    int k=0;
    int max_len=-1;
    while (gets(s[k]))
    {
        int len=strlen(s[k]);
        if (len>max_len) max_len=len;
        for (int i=len;i<102;i++)
        s[k][i]=' ';
        k++;
    }
    for (int i=0;i<max_len;i++)
    {
        for ( int j=k-1;j>=0;j--)
        {
            printf("%c",s[j][i]);
        }
        printf("\n");
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,