#include <bits/stdc++.h>
using namespace std;
int main() {
  char v[1100][1100];
  vector<int> sz;
  int flag = 1;
  int z = 0;
  while (gets(v[z])) {
    int l = strlen(v[z]);
    sz.push_back(l);
    z++;
  }
  int mx = *max_element(sz.begin(), sz.end());
  for (int i = 0; i < mx + 2; i++) cout << "*";
  cout << "\n";
  for (int i = 0; i < z; i++) {
    cout << "*";
    int d, e, f, x;
    f = (mx - sz[i]);
    e = f / 2;
    if (sz[i] == 0)
      d = mx;
    else if (sz[i] > 0 && f % 2 == 0)
      d = e;
    else if (f % 2 == 1) {
      if (flag == 1) {
        d = e;
        flag = 0;
      } else if (flag == 0) {
        d = e + 1;
        flag = 1;
      }
    }
    x = f - d;
    while (d--) cout << " ";
    if (sz[i] != 0) cout << v[i];
    while (x--) cout << " ";
    cout << "*" << endl;
  }
  for (int i = 0; i < mx + 2; i++) cout << "*";
  cout << "\n";
  return 0;
}
