#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> lines;
  int longest = 0;
  string line;
  bool left = true;
  int paddingLength = 0;
  while (getline(cin, line, '\n')) {
    lines.push_back(line);
    longest = max((int)line.size(), longest);
  }
  cout << string(longest + 2, '*') << endl;
  for (vector<string>::iterator it = lines.begin(); it < lines.end(); ++it) {
    cout << "*";
    if (it->size() % 2 == longest % 2) {
      paddingLength = (longest - it->size()) / 2;
      string padding(paddingLength, ' ');
      cout << padding << *it << padding;
    } else {
      paddingLength = ((longest - it->size()) / 2);
      string padding(paddingLength, ' ');
      if (left) {
        it->push_back(' ');
      } else {
        cout << " ";
      }
      cout << padding;
      cout << *it;
      cout << padding;
      left = !left;
    }
    cout << "*" << endl;
  }
  cout << string(longest + 2, '*') << endl;
}
