#include <bits/stdc++.h>
using namespace std;
int maxN = -1;
vector<string> str;
bool ok = false;
int main() {
  string s;
  while (getline(cin, s)) {
    maxN = max(maxN, (int)s.size());
    str.push_back(s);
  }
  for (int i = 0; i < maxN + 2; i++) cout << "*";
  cout << endl;
  int n = str.size();
  for (int i = 0; i < n; i++) {
    cout << '*';
    int ni = str[i].size();
    int align = maxN - ni;
    int space = align / 2;
    if (align % 2 != 0) {
      if (ok == false) {
      } else
        space++;
    }
    for (int j = 0; j < space; j++) cout << ' ';
    cout << str[i];
    if (align % 2 != 0) {
      if (ok == true)
        space--;
      else if (ok == false)
        space++;
    }
    for (int j = 0; j < space; j++) cout << ' ';
    cout << '*';
    cout << endl;
    if (align % 2) ok = !ok;
  }
  for (int i = 0; i < maxN + 2; i++) cout << "*";
  cout << endl;
  return 0;
}
