fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. vector<string>v;
  10. string str;
  11. int mlen=0;
  12.  
  13. for(int i=0;i<5;i++){
  14. cin>>str;
  15.  
  16. int size=str.size();
  17. mlen=max(mlen,size);
  18. v.push_back(str);
  19. }
  20.  
  21. for(int i=0;i<mlen;i++){
  22. for(int j=0;j<5;j++){
  23. if(i>=v[j].size())
  24. continue;
  25.  
  26. cout<<v[j][i];
  27. }
  28. }
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 5332KB
stdin
AABCDD
afzz
09121
a8EWg6
P5h3kx
stdout
Aa0aPAf985Bz1EhCz2W3D1gkD6x