#include <bits/stdc++.h>
using namespace std;
string s[120001], sn, svn;
int i, z, k, l, big;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  while (getline(cin, sn)) {
    k++;
    s[k] = sn;
    big = max(big, int(sn.size()));
  }
  for (i = 1; i <= big + 2; i++) cout << "*";
  cout << '\n';
  for (z = 1; z <= k; z++) {
    svn = "*";
    if ((big - s[z].size()) % 2 == 0) {
      for (i = 1; i <= (big - s[z].size()) / 2; i++) svn += " ";
      svn += s[z];
      for (i = 1; i <= (big - s[z].size()) / 2; i++) svn += " ";
    } else {
      l++;
      if (l % 2 != 0) {
        for (i = 1; i <= (big - s[z].size()) / 2; i++) svn += " ";
        svn += s[z];
        for (i = 1; i <= (big - s[z].size()) / 2 + 1; i++) svn += " ";
      } else {
        for (i = 1; i <= (big - s[z].size()) / 2 + 1; i++) svn += " ";
        svn += s[z];
        for (i = 1; i <= (big - s[z].size()) / 2; i++) svn += " ";
      }
    }
    svn += "*";
    cout << svn << '\n';
  }
  for (i = 1; i <= big + 2; i++) cout << "*";
  cout << '\n';
  return 0;
}
