#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  long long maxi = INT_MIN, count = 0, i, j, flag = true;
  vector<string> v;
  while (getline(cin, s)) {
    count++;
    v.push_back(s);
    long long l = s.length();
    maxi = max(maxi, l);
  }
  for (i = 0; i < maxi + 2; i++) {
    cout << "*";
  }
  cout << endl;
  for (j = 0; j < count; j++) {
    long long len = v[j].size();
    if ((maxi - len) % 2 == 0) {
      cout << "*";
      for (i = 0; i < (maxi - len) / 2; i++) cout << " ";
      cout << v[j];
      for (i = 0; i < (maxi - len) / 2; i++) cout << " ";
      cout << "*";
    } else {
      if (flag == true) {
        cout << "*";
        for (i = 0; i < (maxi - len) / 2; i++) cout << " ";
        cout << v[j];
        for (i = 0; i < ((maxi - len) / 2) + 1; i++) cout << " ";
        cout << "*";
        flag = false;
      } else {
        cout << "*";
        for (i = 0; i < ((maxi - len) / 2) + 1; i++) cout << " ";
        cout << v[j];
        for (i = 0; i < ((maxi - len) / 2); i++) cout << " ";
        cout << "*";
        flag = true;
      }
    }
    cout << endl;
  }
  for (i = 0; i < maxi + 2; i++) {
    cout << "*";
  }
  return 0;
}
