// editor3
#include<iostream>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
int main(){
    string s;
    getline(cin,s);
    for(char c : s){
        if(!(isalpha(c) || c ==' ')){
            cout<<"Invalid";
            return 0;
        }
    }
    vector<string>words;
    string words;
    stringstream ss(s);
    while(ss >>words){
        words.push_back(words);
    }
    intmaxLen = 0;
    for(string w : words){
        if(w.length()>maxLen)
        maxLen = w.length();
    }
    for(int i=0;i<maxLen;i++){
        if(string w : words){
            if(i<w.length())
            line +=w[i];
        }
        cout<<line;
        if(i<maxLen -1)
        cout<<endl;
    }
    return 0;
}