In "rotating sentences," You're asked to rotate a series of input sentences degrees clockwise. So instead of displaying the-input sentences from left-to-right and top-to-bottom, your program would display them from top To bottom.
Input and Output
As input to your program, you'll be given a maximum of the sentences, each of the not exceeding the characters long. Legal characters Include:newline, space, any punctuation characters, digits, and lower case or upper case 中文版 letters . (Note:tabs is not legal characters.)
The output of the program should has the last sentence printed out vertically in the leftmost column; The first sentence of the input would 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,."
----------------------------------------------------------------------------------------
AC Code:
1#include <stdio.h>2 #defineMAXN 100+103 CharARRAY[MAXN][MAXN];4 intROWARRAY[MAXN] = {0};5 intMaxcol =0;6 intMain () {7 8 CharC;9 introw =0, column =0;Ten One inti,j; A - while((c = GetChar ())! =EOF) { - if(c = ='\ n'{//Encounters line break, number of rows plus 1, number of columns clear 0 therow++; -Column =0; -}Else{ -array[row][column++] =C; +++Rowarray[row]; - if(Rowarray[row] >Maxcol) { +Maxcol =Rowarray[row]; A } at } - } - - for(i =0; i < Maxcol; i++){ - for(j = row-1; J >=0; j--){ -c = (i < rowarray[j])? Array[j][i]:' '; inprintf"%c", c); - } toprintf"\ n"); + } - the return 0; *}
One of the things to note is:
27 lines, j = row-1, if j=row, the output will be more than a column of space.
490-rotating sentences