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