#include <bits/stdc++.h>
using namespace std;
int w;
vector<string> v(1);
string s;
int main() {
  while (getline(cin, s)) {
    int leng = s.length();
    v.push_back(s);
    w = max(leng, w);
  }
  int book = 0;
  for (int i = -2; i < w; ++i) printf("*");
  cout << '\n';
  for (int i = 1; i < v.size(); ++i) {
    int leng = w - v[i].size();
    int x = leng / 2;
    int y = (leng + 1) / 2;
    if (x != y) {
      if (book) swap(x, y);
      book ^= 1;
    }
    v[i] = "*" + string(x, ' ') + v[i] + string(y, ' ') + "*";
  }
  for (int i = 1; i < v.size(); ++i) cout << v[i] << endl;
  for (int i = -2; i < w; ++i) printf("*");
  return 0;
}
