#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1200;
string a[MAXN];
string s;
int n, m, d;
int main() {
  while (getline(cin, s)) {
    a[n++] = s;
    m = max(m, (int)s.size());
  }
  for (int i = -2; i < m; i++) cout << "*";
  printf("\n");
  d = 0;
  for (int i = 0; i < n; i++) {
    int k = m - (int)a[i].size();
    cout << "*";
    for (int j = 0; j < (k + d) / 2; j++) cout << " ";
    cout << a[i].c_str();
    for (int j = (k + d) / 2; j < k; j++) cout << " ";
    cout << "*";
    printf("\n");
    if (k & 1) d = 1 - d;
  }
  for (int i = -2; i < m; i++) cout << "*";
  printf("\n");
  return 0;
}
