Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4. int n;
  5. while(1){
  6. string str;
  7. int aux=0,a=0;
  8. vector<string>v;
  9. scanf("%d",&n);
  10. if (n!=0){
  11. while(n--){
  12. cin>>str;
  13. a++;
  14. if (str.size()>aux){
  15. aux=str.size();
  16. }
  17. v.push_back(str);
  18. }
  19. for(int i=0;i<a;i++){
  20. if (v[i].size()<aux){
  21. for(int j=0;j<aux-v[i].size();j++){
  22. printf(" ");
  23. }
  24. }
  25. if (i==a-1){
  26. cout<<v[i]<<endl;
  27. printf("\n");
  28. }else{
  29. cout<<v[i]<<endl;
  30. }
  31. }
  32. }else{
  33. break;
  34. }
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement