#include <bits/stdc++.h>
using namespace std;
long long M = 10000000;
long long F(long long N, long long P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    long long ret = F(N, P / 2);
    return ((ret % M) * (ret % M)) % M;
  } else
    return ((N % M) * (F(N, P - 1) % M)) % M;
}
int main() {
  vector<string> a;
  string s;
  long long int m = 0;
  while (getline(cin, s)) {
    a.push_back(s);
    if (s.size() > m) m = s.size();
  }
  bool temp = true;
  for (long long int i = 0; i < a.size(); i++) {
    if ((m - a[i].size()) % 2 == 0)
      a[i] = '*' + string((m - a[i].size()) / 2, ' ') + a[i] +
             string((m - a[i].size()) / 2, ' ') + '*';
    else if ((m - a[i].size()) % 2 != 0) {
      if (temp) {
        a[i] = '*' + string((m - a[i].size()) / 2, ' ') + a[i] +
               string(((m - a[i].size()) + 1) / 2, ' ') + '*';
        temp = !temp;
      } else {
        a[i] = '*' + string(((m - a[i].size()) + 1) / 2, ' ') + a[i] +
               string((m - a[i].size()) / 2, ' ') + '*';
        temp = !temp;
      }
    }
  }
  for (long long int i = 0; i < m + 2; i++) cout << "*";
  cout << endl;
  for (long long int i = 0; i < a.size(); i++) cout << a[i] << endl;
  for (long long int i = 0; i < m + 2; i++) cout << "*";
}
