#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
int upmin(T1 &x, T2 v) {
  if (x > v) {
    x = v;
    return 1;
  }
  return 0;
}
template <class T1, class T2>
int upmax(T1 &x, T2 v) {
  if (x < v) {
    x = v;
    return 1;
  }
  return 0;
}
const int INF = 0x3f3f3f3f;
vector<string> dict;
void init() {
  for (string s; getline(cin, s);) {
    dict.emplace_back(s);
  }
}
int maxlen;
void preprocess() {
  for (int i = 0; i < dict.size(); ++i) {
    upmax(maxlen, dict[i].size());
  }
  for (int i = 0; i < maxlen + 2; ++i) {
    cout << "*";
    if (i + 1 == maxlen + 2) {
      cout << endl;
    }
  }
  for (int i = 0, t = 0; i < dict.size(); ++i) {
    cout << "*";
    int splen = maxlen - dict[i].size();
    int ls, rs;
    if (~splen & 1) {
      ls = rs = splen / 2;
    } else {
      if (t == 0) {
        ls = (splen - 1) / 2;
        rs = splen - ls;
      } else {
        rs = (splen - 1) / 2;
        ls = splen - rs;
      }
      t ^= 1;
    }
    for (int j = 0; j < ls; ++j) {
      cout << " ";
    }
    cout << dict[i];
    for (int j = 0; j < rs; ++j) {
      cout << " ";
    }
    cout << "*" << endl;
  }
  for (int i = 0; i < maxlen + 2; ++i) {
    cout << "*";
    if (i + 1 == maxlen + 2) {
      cout << endl;
    }
  }
}
void solve() {}
signed main() {
  ios::sync_with_stdio(0);
  init();
  preprocess();
  solve();
  return 0;
}
