#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string x;
  vector<string> v;
  int nax = 0;
  while (getline(cin, x)) {
    nax = max(nax, (int)x.size());
    v.push_back(x);
  }
  for (int i = 0; i < nax + 2; i++) {
    cout << '*';
  }
  cout << endl;
  bool dir = 1;
  for (string& s : v) {
    int n = (int)s.size();
    cout << '*';
    cout << setw(nax);
    if (nax % 2 != n % 2) {
      if (dir) {
        int c = (nax - n) / 2;
        int cc = (nax - n + 1) / 2;
        string sp(c, ' ');
        string sp2(cc, ' ');
        s = sp + s + sp2;
        cout << s;
        dir = !dir;
      } else {
        int c = (nax - n) / 2;
        int cc = (nax - n + 1) / 2;
        string sp(c, ' ');
        string sp2(cc, ' ');
        s = sp2 + s + sp;
        cout << s;
        dir = !dir;
      }
    } else {
      int c = (nax - n) / 2;
      string sp(c, ' ');
      s = sp + s + sp;
      cout << s;
    }
    cout << '*';
    cout << endl;
  }
  for (int i = 0; i < nax + 2; i++) {
    cout << '*';
  }
  cout << endl;
  return 0;
}
