#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
int main() {
  vector<string> v;
  string s;
  while (getline(cin, s)) {
    v.push_back(s);
  }
  int maxlen = 0;
  for (int i = 0; i < int(v.size()); i++)
    maxlen = max(maxlen, (int)v[i].size());
  for (int i = 0; i < int(maxlen + 2); i++) cout << "*";
  cout << endl;
  int cnt = 0;
  for (int i = 0; i < int(v.size()); i++) {
    cout << "*";
    int r = maxlen - v[i].size();
    int ls = r / 2, rs = r / 2;
    if (r & 1) {
      cnt++;
      if (cnt & 1)
        rs++;
      else
        ls++;
    }
    for (int j = 0; j < int(ls); j++) cout << " ";
    cout << v[i];
    for (int j = 0; j < int(rs); j++) cout << " ";
    cout << "*\n";
  }
  for (int i = 0; i < int(maxlen + 2); i++) cout << "*";
  cout << endl;
  return 0;
}
