Uva-490 rotating sentence

Source: Internet
Author: User

Damn question, it's been too long for AC

Rotating sentences 


In ''rotating sentences, ''you are asked to rotate a series of Input sentences 90 degrees clockwise. so instead of displaying the input sentences from left to right and top to bottom, your program will display them
From top to bottom and right to left.

Input and Output

As input to your program, you will be given a maximum of 100 sentences, each not exceeding 100 characters long. legal characters include: newline, space, any punctuation characters, digits, and lower case or upper
Case English letters. (Note: tabs are not legal characters .)

The output of the program shocould have the last sentence printed out vertically in the leftmost column; the first sentence of the input wocould subsequently end up at the rightmost column.

Sample Input

 
Rene decartes once said, "I think, therefore I am ."

Sample output

 
"Rie nteh idnekc, A rttheesreofnocree SIA iadm ,."

Obviously, the output is correct, but it is always wa... I was speechless and felt that my boundary processing capability was not good. Let's take a look at Qingzhu's elegantCodeIt is also a good way to convert all the extra characters into spaces, so you don't have to worry about the boundary.

 
# Include <stdio. h> # include <string. h> char STR [110] [110]; int main () {int I, j, N, K; memset (STR, 0, sizeof (STR )); int size = 0, max = 0; while (gets (STR [size]) {n = strlen (STR [size]); If (n> MAX) max = N; size ++ ;}for (I = 0; I <size; I ++) for (j = 0; j <Max; j ++) if (! STR [I] [J]) STR [I] [J] = ''; For (j = 0; j <Max; j ++) {for (I = size-1; I> = 0; I --) printf ("% C", STR [I] [J]); printf ("\ n");} return 0 ;}

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.