-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path490.cpp
37 lines (30 loc) · 828 Bytes
/
490.cpp
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
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
// for debugging purposes
freopen("input.txt", "r", stdin);
// grab input
string line;
vector<string> lines;
int largest_size = 0, col_width = 0;
while(getline(cin, line))
{
lines.push_back(line);
if(line.size() > largest_size) { largest_size = line.size(); }
}
// print output
for(int i = 0; i < largest_size; i++) // starts with the last string
{
for(int j = lines.size() - 1; j >= 0; j--) // starts with the first letter of the string
{
if(i < lines[j].size()) { cout << lines[j][i]; }
else { cout << " "; }
}
cout << "\n";
}
return 0;
}