#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  queue<string> Q;
  int size = 0;
  string str;
  int l = 0, r = 1;
  while (getline(cin, str)) {
    size = max(size, (int)str.size());
    Q.push(str);
  }
  int len = size + 2;
  while (len--) cout << '*';
  cout << endl;
  while (!Q.empty()) {
    str = Q.front();
    Q.pop();
    cout << '*';
    int tsize = size - str.size();
    len = (tsize >> 1);
    if (tsize & 1) {
      len += l;
      l ^= 1;
    }
    while (len--) cout << " ";
    cout << str;
    len = (tsize >> 1);
    if (tsize & 1) {
      len += r;
      r ^= 1;
    }
    while (len--) cout << " ";
    cout << '*' << endl;
  }
  len = size + 2;
  while (len--) cout << '*';
  cout << endl;
}
