uva400

#include <bits/stdc++.h>
using namespace std;
size_t maxlength[200];
int main(int argc, char const *argv[])
{
int n=1;
vector<string>content;
string line, word;
while(getline(cin, line))
{
stringstream ss(line);
while(ss>>word)

content.push_back(word);
maxlength[n]=max(word.length(), maxlength[n++]);
}
n=1;
content.push_back("\n");
}
for(auto it=content.begin();it!=content.end();it++)
{
if(*it=="\n") n=0;
cout<<left<<setw(maxlength[n++])<<*it;
}
return 0;

}

使用了auto 指针,stringstream 

.lenght()返回值是size_t 与之比较因使用unsigned类型

你可能感兴趣的:(uva400)