#include<iostream>
#include<vector>
#include<algorithm>
#include<sstream>
using namespace std;
const int maxl = 1000 + 5;
const int maxw = 180 + 5;
int main() {
vector<string>t[maxl];
string x, s;
int num1 = 0,mlen[maxw]={0};
while (getline(cin, s)) {
stringstream ss(s);
int pos = 0;
while (ss >> x) {
t[num1].push_back(x);
mlen[pos] = max(mlen[pos], (int)x.length());//记录最大单词长度
pos++;
}
num1++;
}
for (int i = 0; i < num1; i++) {
for (int j = 0; j < t[i].size(); j++) {
if (j)cout << " ";
cout << t[i][j];
if (j == t[i].size() - 1) { cout << "\n"; break; }
for (int k = t[i][j].length(); k < mlen[j]; k++)cout << " ";
}
}
}
掌握vector、string、stringstream基本用法