#include <bits/stdc++.h>
using namespace std;
char a[1001][1001];
long long b, c, d, e, f, g, h;
int main() {
  while (gets(a[d])) {
    h = strlen(a[d]);
    b = max(b, h);
    d++;
  }
  for (; c < b + 2; c++) {
    cout << "*";
  }
  cout << endl;
  for (c = 0; c < d; c++) {
    cout << "*";
    f = b - strlen(a[c]);
    if (f % 2) {
      e = !e;
      f /= 2;
      for (g = 0; g < f + !e; g++) {
        cout << " ";
      }
      cout << a[c];
      for (g = 0; g < f + e; g++) {
        cout << " ";
      }
    } else {
      f /= 2;
      for (g = 0; g < f; g++) {
        cout << " ";
      }
      cout << a[c];
      for (g = 0; g < f; g++) {
        cout << " ";
      }
    }
    cout << "*" << endl;
  }
  for (c = 0; c < b + 2; c++) {
    cout << "*";
  }
  cout << endl;
  return 0;
}
