#include <bits/stdc++.h>
using namespace std;
long long n, kq, k, t;
string a[500000];
int main() {
  n = 0;
  while (getline(cin, a[n + 1], '\n')) n++;
  for (int i = 1; i <= n; i++) {
    long long k1 = a[i].size();
    k = max(k, k1);
  }
  for (int i = 1; i <= k + 2; i++) printf("*");
  cout << "\n";
  for (int i = 1; i <= n; i++) {
    cout << "*";
    long t1 = (k - a[i].size()) / 2, t2 = k - a[i].size() - t1;
    if (t1 != t2)
      if (t == 0) {
        t = 1;
        if (t1 > t2) swap(t1, t2);
      } else {
        t = 0;
        if (t1 < t2) swap(t1, t2);
      }
    for (int j = 1; j <= t1; j++) cout << " ";
    cout << a[i];
    for (int j = 1; j <= t2; j++) cout << " ";
    cout << "*"
         << "\n";
  }
  for (int i = 1; i <= k + 2; i++) printf("*");
}
