#include <bits/stdc++.h>
using namespace std;
vector<string> x;
int main() {
  int mx = 0;
  while (cin.peek() != EOF) {
    string s;
    getline(cin, s);
    x.push_back(s);
    mx = max(mx, (int)s.size());
  }
  mx += 2;
  for (int i = 0; i < mx; ++i) cout << '*';
  cout << "\n";
  bool fl = false;
  for (int i = 0; i < x.size(); ++i) {
    cout << '*';
    int cl = (mx - 2 - x[i].size()) / 2;
    int cl2 = (mx - 2 - x[i].size()) - cl;
    if (cl != cl2) {
      if (fl) {
        if (cl < cl2) {
          swap(cl, cl2);
        }
      } else {
        if (cl2 < cl) {
          swap(cl, cl2);
        }
      }
      fl = !fl;
    }
    for (int i = 0; i < cl; ++i) cout << ' ';
    cout << x[i];
    for (int i = 0; i < cl2; ++i) cout << ' ';
    cout << "*\n";
  }
  for (int i = 0; i < mx; ++i) cout << '*';
  cout << "\n";
}
