#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int M=1000+5;
const int N=180+5;
string s,x;
vector<string> line[M];
int main(){
#ifndef ONLINE_JUDGE
freopen("out.txt","w",stdout);
#endif // ONLINE_JUDGE
int i=0,cntr=0;
while(getline(cin,s)){
stringstream ss(s);
while(ss>>x){
line[i].push_back(x);
}
//cntr=cntr<line[i].size()? line[i].size():cntr;
i++;
}
int cnt=i;
int a[cnt][100];
memset(a,0,sizeof(a));
for(i=0;i<cnt;i++){
for(int j=0;j<line[i].size();j++){
a[i][j]=line[i][j].length();
}
}
int ma[100]={};
for(int j=0;j<100;j++){
for(int i=0;i<cnt;i++){
if(ma[j]<a[i][j])
ma[j]=a[i][j];
}
}
for(int i=0;i<cnt;i++){
for(int j=0;j<line[i].size();j++){
if(j) cout<<" ";
cout<<line[i][j];
//printf("[%d %d]",ma[i],line[i][j].length());
if(j+1!=line[i].size()){
for(int t=0;t<ma[j]-line[i][j].length();t++) cout<<" ";
}
}
cout<<endl;
}
return 0;
}
UVA1593 - Alignment of Code
最新推荐文章于 2020-03-10 16:22:37 发布