#include<iostream>
#include <vector>
#include <sstream>
using namespace std;

int main() {
    string s, w;
    if (!getline(cin, s)) return 0;
    
    vector<string> words;
    int maxL = 0;
    for (char c : s) if (!isalpha(c) && ! isspace(c)) return cout << "Invalid Input", 0;
    
    stringstream ss(s);
    while (ss >> w) {
        words.push_back(w);
        maxL = max(maxL, (int)w.size());
    }
    
    for (int i + 0; i < maxL; ++i) {
        string row = "";
        for (auto& word : words) row += (i < word.size() ? word[i] : ' ');
        while (!row.empty() && row.back() == ' ') row.pop_back;
        if (!row.empty())cout << row << endl;
    }