#include <bits/stdc++.h>
const int OO = (long long)2e9;
const double eps = 1e-9;
const long long MAX = 100001;
const long long MOD = 1000000007;
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int Max = 0;
  string s;
  vector<string> vec;
  while (getline(cin, s)) {
    Max = max(Max, (int)s.size());
    vec.push_back(s);
  }
  bool left = true, right = false;
  for (int i = (0); i < (Max + 2); ++i) cout << "*";
  cout << endl;
  for (int i = (0); i < (vec.size()); ++i) {
    cout << "*";
    if ((Max - vec[i].size()) % 2 == 0) {
      for (int j = 0; j < (Max - vec[i].size()) / 2; j++) cout << " ";
      cout << vec[i];
      for (int j = 0; j < (Max - vec[i].size()) / 2; j++) cout << " ";
    } else if (left) {
      for (int j = 0; j < (Max - vec[i].size()) / 2; j++) cout << " ";
      cout << vec[i];
      for (int j = 0; j < ((Max - vec[i].size()) / 2) + 1; j++) cout << " ";
      left = false;
    } else {
      for (int j = 0; j < ((Max - vec[i].size()) / 2) + 1; j++) cout << " ";
      cout << vec[i];
      for (int j = 0; j < ((Max - vec[i].size()) / 2); j++) cout << " ";
      left = true;
    }
    cout << "*\n";
  }
  for (int i = (0); i < (Max + 2); ++i) cout << "*";
  return 0;
}
