#include<iostream>
#include<vector>
#include<sstream>
#include<algorithm>
#include<cctype>
using namespace std;
int main(){
    string s;
    getline(cin, s);
    
    if(!all_of(s.begin(), s.end(), [] (char ch)){
        return isalpha(ch) || ch == ' ';
    })){
        cout<<"Invalid input";
        return 0;
    }
    vector<string> words;
    stringstream ss(s);
    string word;
    while(ss >> word) {
        words.push_back(word);
    }
    int maxLen = 0;
    if(!words.empty()){
        maxLen = max-element(words.begin(), words.end(),[](string a, string b){
            return a.length() < b.length();
        })->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;
    }