#include <bits/stdc++.h>
using namespace std;
void sf(int &x) { scanf("%d", &x); }
void sf(long long &x) { scanf("%lld", &x); }
void sf(float &x) { scanf("%f", &x); }
void sf(double &x) { scanf("%lf", &x); }
void sf(int &x, int &y) { scanf("%d%d", &x, &y); }
void sf(long long &x, long long &y) { scanf("%lld%lld", &x, &y); }
void sf(float &x, float &y) { scanf("%f%f", &x, &y); }
void sf(double &x, double &y) { scanf("%lf%lf", &x, &y); }
void sf(double &x, double &y, double &z) { scanf("%lf%lf%lf", &x, &y, &z); }
void sf(int &x, int &y, int &z) { scanf("%d%d%d", &x, &y, &z); }
void sf(long long &x, long long &y, long long &z) {
  scanf("%lld%lld%lld", &x, &y, &z);
}
void sf(float &x, float &y, float &z) { scanf("%u%u%u", &x, &y, &z); }
void sf(char &x) { x = getchar(); }
void sf(char *s) { scanf("%s", s); }
void sf(string &s) { cin >> s; }
void sf(string &s, string &ss) { cin >> s >> ss; }
void pf(int x) { printf("%d\n", x); }
void pf(int x, int y) { printf("%d %d\n", x, y); }
void pf(long long x) { printf("%lld\n", x); }
void pf(long long x, long long y) { printf("%lld %lld\n", x, y); }
void pf(float x) { printf("%u\n", x); }
void pf(unsigned long long x) { printf("%llu\n", x); }
void pf(double x) { printf("%.6lf\n", x); }
void pf(double x, double y) { printf("%.5lf %.5lf\n", x, y); }
void pf(char x) { printf("%c\n", x); }
void pf(char *x) { printf("%s\n", x); }
void pf(string x) {
  cout << x;
  puts("");
}
void pf(int x, int y, int z) { printf("%d %d %d\n", x, y, z); }
template <class T>
T bigmod(T b, T p, T m) {
  if (p == 0) return 1 % m;
  T x = b;
  T ans = 1;
  while (p) {
    if (p & 1) ans = (ans * x) % m;
    p >>= 1;
    x = (x * x) % m;
  }
  return ans;
}
template <class T>
T gcd(T x, T y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
template <typename T>
T POW(T b, T p) {
  if (p == 1) return b;
  if (p % 2 == 0) {
    T s = POW(b, p / 2);
    return s * s;
  }
  return b * POW(b, p - 1);
}
template <typename T>
T modinv(T num, T m) {
  return bigmod(num, m - 2, m);
}
template <typename T>
long long triangle(T a, T b, T c) {
  return (c.x - a.x) * (b.y - a.y) - (b.x - a.x) * (c.y - a.y);
}
int a, b, c, l[1009];
string s[1009];
int main() {
  while (getline(cin, s[a])) {
    l[a] = s[a].size();
    b = max(b, l[a]);
    a++;
  }
  for (int i = 0; i < b + 2; i++) cout << "*";
  puts("");
  c = 0;
  for (int i = 0; i < a; i++) {
    cout << "*";
    int kk = b - l[i];
    if (kk & 1) {
      if (c == 0) {
        int k = kk / 2;
        int j = kk - k;
        for (int m = 0; m < k; m++) cout << " ";
        cout << s[i];
        for (int m = 0; m < j; m++) cout << " ";
        cout << "*";
      } else {
        int k = kk / 2;
        int j = kk - k;
        for (int m = 0; m < j; m++) cout << " ";
        cout << s[i];
        for (int m = 0; m < k; m++) cout << " ";
        cout << "*";
      }
    } else {
      int k = kk / 2;
      int j = kk - k;
      for (int m = 0; m < j; m++) cout << " ";
      cout << s[i];
      for (int m = 0; m < k; m++) cout << " ";
      cout << "*";
    }
    puts("");
    if (kk & 1) {
      if (c == 0)
        c = 1;
      else
        c = 0;
    }
  }
  for (int i = 0; i < b + 2; i++) cout << "*";
  return 0;
}
