#include <bits/stdc++.h>
using namespace std;
inline void init() {}
string lines[1001];
int main() {
  string s;
  int n = 0;
  int mx = 0;
  while (getline(cin, lines[n])) {
    mx = std::max<int>(mx, lines[n].length());
    n++;
  }
  cout << string(mx + 2, '*') << endl;
  int sw = 0;
  for (int i = 0; i < n; i++) {
    cout << '*';
    int len = lines[i].length();
    if (len % 2 != mx % 2) {
      if (sw) {
        lines[i] = " " + lines[i];
      } else {
        lines[i] += " ";
      }
      sw = !sw;
    }
    int d = mx - len;
    if (d) cout << string(d / 2, ' ');
    cout << lines[i];
    if (d) cout << string(d / 2, ' ');
    cout << "*\n";
  }
  cout << string(mx + 2, '*') << endl;
  return 0;
}
