#include <bits/stdc++.h>
using namespace std;
ifstream fin("1.in");
void solve() {
  string s;
  vector<string> arr;
  int length = 0;
  while (getline(cin, s) && s != "\n") {
    arr.push_back(s);
    length = max(length, int(s.size()));
  }
  for (int i = 0; i < length + 2; i++) cout << '*';
  cout << endl;
  int turn = 0;
  for (int i = 0; i < arr.size(); i++) {
    int l = (length - arr[i].size()) / 2;
    if ((length - arr[i].size()) % 2) {
      l += turn;
      turn = 1 - turn;
    }
    cout << '*';
    for (int j = 0; j < l; j++) cout << ' ';
    cout << arr[i];
    for (int j = 0; j < length - l - arr[i].size(); j++) cout << ' ';
    cout << '*' << endl;
  }
  for (int i = 0; i < length + 2; i++) cout << '*';
  cout << endl;
}
int main() {
  solve();
  return 0;
}
