#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  vector<string> str;
  bool lor = true;
  int max_len = 0;
  while (getline(cin, s)) {
    str.push_back(s);
    if (s.length() > max_len) max_len = s.length();
  }
  for (int i = 0; i < max_len + 2; i++) cout << "*";
  cout << endl;
  for (vector<string>::iterator it = str.begin(); it != str.end(); it++) {
    string temp = *it;
    int start = (max_len - temp.length()) / 2;
    cout << "*";
    for (int j = 0; j < start; j++) cout << " ";
    if ((temp.length() % 2 != 0 && max_len % 2 == 0) ||
        (temp.length() % 2 == 0 && max_len % 2 != 0)) {
      if (!lor) {
        cout << " ";
        start++;
        lor = true;
      } else {
        lor = false;
      }
    }
    cout << temp;
    int end = max_len - temp.length() - start;
    for (int j = 0; j < end; j++) cout << " ";
    cout << "*" << endl;
  }
  for (int i = 0; i < max_len + 2; i++) cout << "*";
  return 0;
}
