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