#include <bits/stdc++.h>
using namespace std;
int main() {
  string line;
  int maxWidth = 0;
  vector<string> lines;
  while (getline(cin, line)) {
    lines.push_back(line);
    maxWidth = max<int>(maxWidth, line.size());
  }
  bool left = false;
  cout << string(maxWidth + 2, '*') << endl;
  for (auto& line : lines) {
    int padding = maxWidth - line.size();
    cout << "*" << string(padding / 2, ' ');
    if (padding % 2) {
      if (left)
        line.insert(line.begin(), ' ');
      else
        line.push_back(' ');
      left = !left;
    }
    cout << line << string(padding / 2, ' ') << '*' << endl;
  }
  cout << string(maxWidth + 2, '*') << endl;
  return 0;
}
