#include<iostream>
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>w;
    string t;
    stringstream ss(s);
    while (ss >> t)w.push_back(t);
    int mx = 0;
    for (auto &x :w) mx = max(mx, (int)x.size());
    
    for(int i = 0; i < mx; i++){
        for (auto &x :w)
        if (i<x.size ()) cout << x[i];
        cout << endl;
    }
    return 0;
}