#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 word;
    stringstream ss(s);
    while(ss >> word) {
        words.push_back(word);
    }
    int maxLen=0;
    for(string w:words) {
        if(w.length() > maxLen)
        maxLen=w.length();
    }
    for(int i=0;i<maxlen;i++){
        string line = "";
        for(int j=0;j<words.size(); j++){
            if(i<words[j].length())
            line += words[j][i];
            else
            line +=" ";
        }
        int end=line.length() -1;
        while(end >= 0 && line[end]=='')
        end--;
        cout<<line.substr(0,end + 1)<<endl;
    }
    return 0;
}