#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535897932384626433832795;
const double eps = 1e-12;
const int INF = 1 << 30;
const long long LINF = 1ll << 60;
const int BUFFER_SZ = 1 << 20;
const int MOD = 1000 * 1000 * 1000 + 7;
char BUFFER[BUFFER_SZ];
int gi() {
  int x;
  scanf("%d", &x);
  return x;
}
double gd() {
  double x;
  scanf("%lf", &x);
  return x;
}
long long gll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
vector<int> gvi(int n) {
  vector<int> a;
  while (n-- > 0) a.push_back(gi());
  return a;
}
string gs() {
  scanf("%s", BUFFER);
  return string(BUFFER);
}
template <class T>
void print(vector<T> &x, string format) {
  format += "%c";
  for (int i = 0; i < x.size(); ++i)
    printf(format.c_str(), x[i], i + 1 == x.size() ? '\n' : ' ');
}
void solve() {
  vector<string> S;
  int mx = 0;
  while (gets(BUFFER)) {
    string s(BUFFER);
    mx = max(mx, (int)s.size());
    S.push_back(s);
  }
  printf("%s\n", string(mx + 2, '*').c_str());
  int add = 0;
  for (string s : S) {
    int rem = mx - s.size();
    int a = rem / 2;
    int b = rem / 2;
    if (a + b < rem) {
      a += add;
      b += 1 - add;
      add = 1 - add;
    }
    printf("*%s%s%s*\n", string(a, ' ').c_str(), s.c_str(),
           string(b, ' ').c_str());
  }
  printf("%s\n", string(mx + 2, '*').c_str());
}
int main() {
  solve();
  return 0;
}
