#include <bits/stdc++.h>
using namespace std;
vector<string> vec;
int main() {
  string s;
  while (getline(cin, s)) {
    vec.push_back(s);
  }
  int vec_size = vec.size();
  int mx = 0;
  for (int i = 0; i < vec_size; i++) {
    mx = max(mx, int(vec[i].size()));
  }
  bool mv = 0;
  for (int i = 0; i < vec_size; i++) {
    int diff = mx - vec[i].size();
    int l = (diff + mv) / 2;
    int r = (diff + !mv) / 2;
    if (diff & 1) mv = !mv;
    while (l--) vec[i] = " " + vec[i];
    while (r--) vec[i] = vec[i] + " ";
    vec[i] = "*" + vec[i] + "*";
  }
  cout << string(mx + 2, '*') << endl;
  for (int i = 0; i < vec_size; i++) {
    cout << vec[i] << endl;
  }
  cout << string(mx + 2, '*') << endl;
}
