#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double PI = acos(-1);
const double EPS = 1e-8;
int main() {
  string s;
  vector<string> v;
  while (getline(cin, s)) {
    v.push_back(s);
  }
  int len = 0;
  for (int i = 0; i < (int)v.size(); ++i) {
    len = max(len, (int)v[i].size());
  }
  cout << string(len + 2, '*') << endl;
  int cnt = 0;
  for (int i = 0; i < (int)v.size(); ++i) {
    int a = (len - v[i].size()) / 2;
    if (v[i].size() % 2 ^ len % 2) {
      if (cnt % 2) {
        a++;
      }
      cnt++;
    }
    cout << "*" << string(a, ' ') << v[i] << string(len - a - v[i].size(), ' ')
         << "*" << endl;
  }
  cout << string(len + 2, '*') << endl;
}
