#include<iostream>
#include<sstream>
#include<vector>
#include<string>
#include<cctype>
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>word;
    string temp;
    stringstream ss(s);
    while(ss >> temp)
    word.push_back(temp);
    int maxLen = 0;
    for(string w : word)
    
if(w.length() > maxLen)
maxLen = w.length();
for(int i = 0;i<maxLen;i++)
{
    string line = "";
    for(int j =0;j<word.size();j++)
    {
        if(i<word[j].length())
        line += word[j][i];
        else
        line += ' ';
    }
    while(!line.empty() && line.back()==' ')
    line.pop_back();
    cout<<line;
    if(i ! = maxLen-1) cout<< endl;
}
return 0;
    
}