UVa 490 Rotating sentences (water ver.)

Source: Internet
Author: User
Tags time limit

490-rotating sentences

Time limit:3.000 seconds

Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem &problem=431

In ' rotating sentences, ' your are asked to rotate a series of input sentences degrees. So instead of displaying the ' input sentences ' to ' right ' and ' to bottom ', your program'll display them from top To bottom and right to left.

Input and Output

As input to the your program, you'll be given a maximum of sentences, and each isn't exceeding characters long. Legal characters Include:newline, space, any punctuation characters, digits, and lower case or upper case 中文版 letters . (Note:tabs are not legal characters.)

The output of the program should have the "last sentence" printed out vertically in the leftmost column; The ' the ' of the ' input would subsequently end of the ' sentence ' rightmost column.

Sample Input

Rene Decartes once said,
"I am, therefore I am."

Sample Output

"R
Ie
 n
te
h 
iD
ne
kc
, a
 r
TT
he
es
R
eo
fn
OC
re
e
Ia
 i
ad
m,
.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

Note that you want to output the blanks after the short sentences.

Complete code:

/*0.012s*/
  
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace Std;
  
Char in[110][110];
int len[110];
  
int main (void)
{
    int i, j, idx = 0, Max = 0;
    while (gets (In[idx]))
    {
        Len[idx] = strlen (IN[IDX));
        max = max (max, len[idx++]);
    for (j = 0; J < Max; J +)
    {for
        (i = idx-1 i >= 0; i--)
            Putchar (J < len[i]? In[i][j]: '); 
  putchar (' \ n ');
    }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.