#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
string s;
char c;
int n, mx = -1, k = -1;
vector<string> a;
int main() {
  while (getline(cin, s)) {
    int n = s.size();
    mx = max(mx, n);
    a.push_back(s);
  }
  for (int i = 0; i < mx + 2; i++) cout << '*';
  cout << "\n";
  for (int i = 0; i < a.size(); i++) {
    cout << '*';
    int len = mx - a[i].size();
    if (len % 2 == 0) {
      for (int j = 0; j < len / 2; j++) cout << " ";
      cout << a[i];
      for (int j = 0; j < len / 2; j++) cout << " ";
    } else {
      k++;
      for (int j = 0; j < len / 2 + k % 2; j++) cout << " ";
      cout << a[i];
      for (int j = 0; j < len / 2 + 1 - k % 2; j++) cout << " ";
    }
    cout << "*\n";
  }
  for (int i = 0; i < mx + 2; i++) cout << '*';
  cout << "\n";
  return 0;
}
