#include <bits/stdc++.h>
using namespace std;
string a[1005];
int main() {
  string s;
  int max = 0, k = 0;
  while (getline(cin, s)) {
    a[k++] = s;
    max = (((max) > (s.size())) ? (max) : (s.size()));
  }
  int n = max;
  for (int i = 0; i < (n + 2); ++i) cout << '*';
  cout << endl;
  int of = 0;
  for (int i = 0; i < (k); ++i) {
    cout << '*';
    int p = n - a[i].size();
    int ofs = 0;
    if (p % 2) ofs = of;
    for (int j = 0; j < (p / 2 + ofs); ++j) cout << ' ';
    cout << a[i];
    for (int j = (p / 2 + ofs); j < (p); ++j) cout << ' ';
    if (p % 2) of ^= 1;
    cout << '*' << endl;
  }
  for (int i = 0; i < (n + 2); ++i) cout << '*';
  cout << endl;
  return 0;
}
