#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  vector<string> v;
  int max = -1;
  bool was = true;
  while (getline(cin, s)) {
    v.push_back(s);
    if ((int)s.length() > max) max = s.length();
  }
  cout << string(max + 2, '*') << endl;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].length() < max) {
      if ((max - v[i].length()) & 1) {
        if (was) {
          cout << "*" << string((max - v[i].length()) / 2, ' ') << v[i]
               << string((max - v[i].length()) / 2 + 1, ' ') << "*" << endl;
        } else {
          cout << "*" << string((max - v[i].length()) / 2 + 1, ' ') << v[i]
               << string((max - v[i].length()) / 2, ' ') << "*" << endl;
        }
        was = !was;
      } else {
        cout << "*" << string((max - v[i].length()) >> 1, ' ') << v[i]
             << string((max - v[i].length()) >> 1, ' ') << "*" << endl;
      }
    } else {
      cout << "*" << v[i] << "*" << endl;
    }
  }
  cout << string(max + 2, '*') << endl;
  return 0;
}
