// editor2
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
int main(){
    string s;
    if(!getline(cin, s))return 0;
     for(char c : s){
         if(!isalpha(c) && !isspace(c))
         {
             cout<<"Invalid input"<<endl;
             return 0;
         }
     }
     vector<string>words;
     stringstream ss(s);
     string word;
     int maxLen = 0;
     
     while(ss>>word){
         words.push_back(word);
         maxLen=max(maxLen,(int)word.length());
     }
     if(words.empty())return 0;
     
     for (int i=0;i<maxLen;++i){
         string row = "";
         for(const string&w:words){
        
           if(i < w.length()){
              row+=w[i];
            }
            else{
              row+="";
            }
        }
    
     size_t last = row.find_last_not_of('');
     if(last!= string::npos){
         cout<<row.substr(0,last+1)<<endl;
     }
     else if(!row.empty()){
         
     }
    }
     return 0;
    
}