#include<iostream>
#include<vector>
#include<string>
#include<type_traits>
#include<sstream>
#include<tuple>
#include<bitset>
#include<regex>
#include<set>
#include<queue>
using namespace std;
int main(){
string s;
vector<vector<string>> data;
int lines = 0;
int max_length = -1;
while (getline(cin, s)){
vector<string> data1;
stringstream is(s);
string t;
while (is >> t) data1.push_back(t);
if ((int)data1.size() > max_length)
max_length = data1.size();
data.push_back(data1);
lines++;
}
vector<string> result(lines,"");
for (int i = 0; i < max_length; i++){
int max2 = 0;
for (int j = 0; j < lines; j++){
if (i >= data[j].size()) continue;
if (data[j][i].size()>max2) max2 = data[j][i].size();
}
for (int j = 0; j < lines; j++){
if (i >= data[j].size()) continue;
result[j] += data[j][i];
if (i < data[j].size() - 1){
result[j] += string(max2 - data[j][i].size()+1, ' ');
}
}
}
for (int i = 0; i < lines; i++) cout << result[i] << endl;
//system("pause");
return 0;
}
UVA 1593
最新推荐文章于 2020-02-09 15:39:18 发布