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