#include <bits/stdc++.h>
using namespace std;
static const int MAXN = 1000;
string s[MAXN + 10];
int main() {
  int k = 0, len = 0;
  while (getline(cin, s[++k])) len = max(len, (int)s[k].size());
  for (int i = 1; i <= len + 2; i++) cout << "*";
  cout << endl;
  int flag = 0;
  for (int i = 1; i <= k - 1; i++) {
    cout << "*";
    if (len % 2 == s[i].size() % 2) {
      for (int j = 1; j <= (len - s[i].size()) / 2; j++) cout << " ";
      cout << s[i];
      for (int j = 1; j <= (len - s[i].size()) / 2; j++) cout << " ";
    } else {
      for (int j = 1; j <= (len - s[i].size()) / 2 + flag; j++) cout << " ";
      cout << s[i];
      for (int j = 1; j <= len - s[i].size() - (len - s[i].size()) / 2 - flag;
           j++)
        cout << " ";
      flag = 1 - flag;
    }
    cout << "*" << endl;
  }
  for (int i = 1; i <= len + 2; i++) cout << "*";
  cout << endl;
  return 0;
}
