#include<iostream>
#include<vector>
#include<sstream>
using namespace std;
int main(){
    string s;
    getline(cin,s);
    for(char c:s){
        if(!(isalpha(c) || c ==' ')){
            cout<<"Invalid input";
            return 0;
        }
    }
    vector<string>words;
    string w;
    stringstream ss(s);
    while(ss>>w)words.push_back(w);
    int maxLen=0;
    for(string x:words)
    if(x.length()>maxLen)
    maxLen=x.length();
    {for(int i=0;<maxLen;i++){
        string line="";
        ofr(int j =0;j<words.size();j++){
            if(i<words[j].length())
            line+= words[j][i];
            else
            line+=" ";
        }
        while(!line.empty()&&line.back()==' ')
        line.pop_back();
        cout<<line<<endl;
    }
    return 0;
}