#include <bits/stdc++.h>
using namespace std;
string s[1005];
int main() {
  int n = 0;
  int max = 1;
  while (getline(cin, s[n])) {
    if (s[n].length() > max) {
      max = s[n].length();
    }
    n++;
  }
  for (int i = 1; i <= max + 2; i++) cout << "*";
  cout << endl;
  bool b = true;
  for (int i = 0; i < n; i++) {
    cout << "*";
    int k = (max - s[i].length()) % 2;
    int p = (max - s[i].length()) / 2;
    if (k == 0) {
      for (int j = 1; j <= p; j++) cout << " ";
      cout << s[i];
      for (int j = 1; j <= p; j++) cout << " ";
    } else {
      if (b == true) {
        for (int j = 1; j <= p; j++) cout << " ";
        cout << s[i];
        for (int j = 1; j <= p + 1; j++) cout << " ";
        b = false;
      } else {
        for (int j = 1; j <= p + 1; j++) cout << " ";
        cout << s[i];
        for (int j = 1; j <= p; j++) cout << " ";
        b = true;
      }
    }
    cout << "*\n";
  }
  for (int i = 1; i <= max + 2; i++) cout << "*";
  cout << endl;
  return 0;
}
