UVa490

題目:
https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=431

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <algorithm>

using namespace std;

int main(){
vector<string> v;
string in;
int longest = 0;
while(getline(cin, in)){
v.push_back(in);
longest = max(longest, (int)in.length());
}

for(int i=0; i<longest; ++i){
for(int j=v.size()-1; j>=0; --j){
if(i < v[j].size()) cout << v[j][i];
else cout << ' ';
}
cout << '\n';
}
}