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 ');
}