#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  long n = 0, ma = 0, f = 0;
  string a[2005];
  while (getline(cin, a[++n]))
    if (a[n].length() > size_t(ma)) ma = a[n].length();
  n--;
  for (long i = 1; i <= ma + 2; i++) cout << '*';
  cout << endl;
  for (long i = 1; i <= n; i++) {
    cout << '*';
    if (a[i].empty()) {
      for (long o = 1; o <= (ma); o++) cout << ' ';
      ;
      cout << '*' << endl;
      continue;
    }
    if (a[i].length() == size_t(ma)) {
      cout << a[i] << '*' << endl;
      continue;
    }
    long r = ma - a[i].length();
    if (!(r & 1)) {
      for (long o = 1; o <= (r >> 1); o++) cout << ' ';
      ;
      cout << a[i];
      for (long o = 1; o <= (r >> 1); o++) cout << ' ';
      ;
      cout << '*' << endl;
    } else {
      for (long o = 1; o <= ((r >> 1) + f); o++) cout << ' ';
      ;
      cout << a[i];
      for (long o = 1; o <= ((r >> 1) + (f ^ 1)); o++) cout << ' ';
      ;
      cout << '*' << endl;
      f ^= 1;
    }
  }
  for (long i = 1; i <= ma + 2; i++) cout << '*';
  cout << endl;
  return 0;
}
