#include<iostream>
#include<vector>
#include<string>
#include<sstream>
#include<algorithm>
using namespace std;
int main()
{
    string input;
    if(!getline(cin, input) || input.empty()) return 0;
    for(char c: input){
        if(!isalpha(c) && c !=' '){
            cout<<"Invalid Input"<<endl;
            return 0;
        }
    }
    vector<string>words;
    stringstream ss(input);
    string word;
    int maxLen = 0;
    while (ss >> word){
        woed.push_back(word);
        maxLen = max((int)word.length(),maxLen);
    }
    for(int i=0;i<maxLen; ++i){
        string line ="";
        for(const string& w : words){
            if(i<w.length()){
                line += w[i];
            }else{
                line +=' ';
            }
        }
        size_t last = line.find_last_not_of(' ');
        if(last != string::npos){
            cout<<line.substr(0, last + 1)<<endl;
        }
    }
    return 0;
}