#include <bits/stdc++.h>
using namespace std;
int main() {
  string Data, ans;
  int max_size = 0, change = 0;
  vector<string> Attack;
  while (getline(cin, Data)) {
    Attack.push_back(Data);
    if (Data.size() > max_size) max_size = Data.size();
  }
  max_size += 2;
  for (int i = 0; i < max_size; i++) ans += '*';
  cout << ans << endl;
  for (int i = 0; i < Attack.size(); i++) {
    cout << "*";
    for (int i2 = 1; i2 < (max_size - Attack[i].size() + change) / 2; i2++)
      cout << " ";
    for (int i2 = 0; i2 < Attack[i].size(); i2++) cout << Attack[i][i2];
    for (int i2 = 0; i2 < ((max_size - Attack[i].size() + 1 - change) / 2) - 1;
         i2++)
      cout << " ";
    cout << "*" << endl;
    if ((max_size - Attack[i].size()) % 2 != 0) change = 1 - change;
  }
  cout << ans << endl;
  return 0;
}
