#include <bits/stdc++.h>
using namespace std;
long long n, z = 1, x, c, zx;
map<string, long long> m;
string a[1001], s;
int main() {
  while (getline(cin, s)) {
    a[n++] = s;
    zx = max(zx, (long long)s.size());
  }
  for (int i = -2; i < zx; i++) cout << "*";
  cout << "\n";
  for (int i = 0; i < n; i++) {
    int k = zx - (long long)a[i].size();
    cout << "*";
    for (int j = 0; j < (k + x) / 2; j++) cout << " ";
    cout << a[i].c_str();
    for (int j = (k + x) / 2; j < k; j++) cout << " ";
    cout << "*"
         << "\n";
    if (k & 1) x = 1 - x;
  }
  for (int i = -2; i < zx; i++) cout << "*";
}
