现在的位置: 首页 > 综合 > 正文

490 – Rotating Sentences

2013年03月31日 ⁄ 综合 ⁄ 共 312字 ⁄ 字号 评论关闭
#include <cstdio>
#include <cstring>
int main()
{
    char str1[110][110];
    int i,j,count(0),max(0);
    memset(str1,0,sizeof(str1));
    while(gets(str1[count]))
    {
        if(max<strlen(str1[count]))
            max=strlen(str1[count]);
        count++;
    }
    for(i=0; i<max; i++)
    {
        for(j=(count-1); j>=0; j--)
            printf("%c",(i<strlen(str1[j])?str1[j][i]:' '));
        printf("\n");
    }
    return 0;
}

抱歉!评论已关闭.