#include <bits/stdc++.h>
using namespace std;
void solve(istream& is, ostream& os) {
  vector<string> t;
  size_t m = 0;
  while (is) {
    string s;
    getline(is, s);
    if (s.empty() && !is) break;
    t.push_back(s);
    m = max(m, s.length());
  }
  os << string(m + 2, '*') << endl;
  int f = 0;
  for (int i = 0; i < t.size(); ++i) {
    int l = t[i].size();
    int o = (m - l) / 2;
    int left = o, right = o;
    if ((m - l) & 1) {
      left += f;
      right += f ^ 1;
      f ^= 1;
    }
    os << "*" << string(left, ' ') << t[i] << string(right, ' ') << "*" << endl;
  }
  os << string(m + 2, '*') << endl;
}
const char* liner = "--------";
int problem;
int problem_filter;
void run(int line, const char* input, const char* output) {
  problem += 1;
  if (problem_filter != -1 && problem_filter != problem) return;
  stringstream is(input);
  stringstream os;
  solve(is, os);
  if (os.str() != output) {
    cerr << "Case #" << problem << ": FAILED (line " << line << ")" << endl;
    cerr << liner << "EXPECTED" << liner << endl << output;
    cerr << liner << "-ACTUAL-" << liner << endl
         << os.str() << liner << liner << liner << endl;
  } else
    cerr << "Case #" << problem << " OK (line " << line << ")" << endl;
}
int main(int argc, char* argv[]) {
  istream& is = cin;
  ostream& os = cout;
  solve(is, os);
  return 0;
}
