#include <bits/stdc++.h>
using namespace std;
int main() {
  ifstream txt;
  txt.open("input.txt");
  string s;
  vector<string> vec(1);
  int maxx = -1;
  while (getline(cin, s)) {
    getline(txt, s);
    vec.push_back(s);
    if (maxx < (int)s.length()) maxx = s.length();
  }
  vec.push_back(string());
  for (int i = 0; i < maxx + 2; i++) {
    vec[0] += "*";
    vec[vec.size() - 1] += "*";
  }
  int ind = 1;
  cout << vec[0] << endl;
  for (int i = 1; i < vec.size() - 1; i++) {
    ind = ind % 2;
    int len = vec[i].length();
    len = maxx - len;
    int r = len / 2;
    int l = len - r;
    if (r != l && vec[i].length() != 0) {
      if (ind == 1) {
        l = min(r, l);
        r = len - l;
      }
      ind++;
    }
    cout << "*";
    for (int j = 0; j < l; j++) cout << " ";
    cout << vec[i];
    for (int j = 0; j < r; j++) cout << " ";
    cout << "*";
    cout << endl;
  }
  cout << vec[vec.size() - 1];
  txt.close();
  return 0;
}
