#include <bits/stdc++.h>
using namespace std;
vector<string> v1;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  int mx = 0;
  while (getline(cin, s)) {
    v1.push_back(s);
    mx = max(mx, (int)s.size());
  }
  cout << string(mx + 2, '*') << endl;
  bool l = 0;
  for (int i = 0; i < v1.size(); i++) {
    cout << "*";
    int rem = mx - v1[i].size();
    if (rem % 2 && l) cout << " ";
    cout << string(rem / 2, ' ');
    cout << v1[i];
    if (rem % 2 && !l) cout << " ";
    if (rem % 2) l = !l;
    cout << string(rem / 2, ' ');
    cout << "*" << endl;
  }
  cout << string(mx + 2, '*') << endl;
  return 0;
}
