#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[1000];
  string t;
  int cnt = 0;
  int mx = 0;
  while (getline(cin, t)) {
    s[cnt++] = t;
    mx = max(mx, (int)t.length());
  }
  bool ok = false;
  for (int i = 0; i < cnt; i++) {
    string result = "*";
    if (s[i].length() % 2 == mx % 2) {
      int temp = (mx - s[i].length()) / 2;
      for (int j = 0; j < temp; j++) result.push_back(' ');
      for (auto u : s[i]) result.push_back(u);
      for (int j = 0; j < temp; j++) result.push_back(' ');
      result.push_back('*');
    } else {
      int temp1 = (mx - s[i].length()) / 2;
      int temp2 = (mx - s[i].length() + 1) / 2;
      if (ok)
        ok = false, swap(temp1, temp2);
      else
        ok = true;
      for (int j = 0; j < temp1; j++) result.push_back(' ');
      for (auto u : s[i]) result.push_back(u);
      for (int j = 0; j < temp2; j++) result.push_back(' ');
      result.push_back('*');
    }
    s[i] = result;
  }
  for (int i = 0; i < mx + 2; i++) cout << "*";
  cout << endl;
  for (int i = 0; i < cnt; i++) cout << s[i] << endl;
  for (int i = 0; i < mx + 2; i++) cout << "*";
  cout << endl;
  return 0;
}
