#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  vector<string> V;
  string ln;
  int mx = 0;
  while (getline(cin, ln)) {
    V.push_back(ln);
    mx = max(mx, (int)ln.size());
  }
  cout << string(mx + 2, '*') << "\n";
  int k = 0;
  for (int i = 0; i < V.size(); ++i) {
    int aux = (mx - V[i].size());
    int l = aux / 2, r = aux / 2;
    if (k % 2)
      l += aux % 2;
    else
      r += aux % 2;
    k += aux % 2;
    cout << "*" << string(l, ' ') << V[i] << string(r, ' ') << "*\n";
  }
  cout << string(mx + 2, '*') << "\n";
  return 0;
}
