#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> v;
  string str;
  while (getline(cin, str)) {
    v.push_back(str);
  }
  int size = 0;
  for (int i = 0; i < v.size(); i++) {
    size = max(size, (int)v[i].size());
  }
  for (int i = 1; i <= size + 2; i++) cout << "*";
  cout << '\n';
  int k = 0;
  for (int i = 0; i < v.size(); i++) {
    int space = size - v[i].size();
    int lspace = space / 2, rspace = space / 2;
    if (space % 2) {
      k++;
      if (k % 2) {
        rspace += 1;
      } else {
        lspace += 1;
      }
    }
    cout << "*";
    for (int j = 1; j <= lspace; j++) cout << " ";
    cout << v[i];
    for (int j = 1; j <= rspace; j++) cout << " ";
    cout << "*";
    cout << '\n';
  }
  for (int i = 1; i <= size + 2; i++) cout << "*";
  return 0;
}
