#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  vector<string> l;
  int maxlen = 0;
  while (getline(cin, s)) {
    l.push_back(s);
    int n = s.length();
    maxlen = max(maxlen, n);
  }
  for (int i = 1; i <= maxlen + 2; i++) {
    cout << "*";
  }
  cout << endl;
  bool left = true;
  for (int i = 0; i <= l.size() - 1; i++) {
    cout << "*";
    int d = maxlen - l[i].length();
    int a = d / 2, b = d / 2;
    if (d % 2 == 1) {
      if (!left) {
        a++;
      } else {
        b++;
      }
      left = !left;
    }
    for (int j = 1; j <= a; j++) {
      cout << " ";
    }
    cout << l[i];
    for (int j = 1; j <= b; j++) {
      cout << " ";
    }
    cout << "*" << endl;
  }
  for (int i = 1; i <= maxlen + 2; i++) {
    cout << "*";
  }
  cout << endl;
  return 0;
}
