#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long ll_inf = 0x3f3f3f3f3f3f3f3fll;
const long double eps = 1e-8;
const long double pi = acos(-1);
const int N = 2e6 + 1000;
char Vs[1000][1505];
string s;
void print1(int t) {
  while (t--) {
    cout << " ";
  }
}
void print2(int t) {
  while (t--) {
    cout << "*";
  }
}
int len;
void init() {}
void read() {
  while (gets(Vs[len])) {
    ++len;
  }
}
void solve() {
  int Max = 0;
  for (int i = 0; i < len; i++) {
    Max = max(Max, (int)strlen(Vs[i]));
  }
  print2(Max + 2);
  cout << endl;
  int cur = 0;
  for (int i = 0; i < len; i++) {
    print2(1);
    int n = (int)strlen(Vs[i]);
    print1((Max - n + cur) / 2);
    cout << Vs[i];
    print1((Max - n + 1 - cur) / 2);
    if ((Max - n) % 2) cur = !cur;
    print2(1);
    cout << endl;
  }
  print2(Max + 2);
  cout << endl;
}
void write() {}
int main() {
  int T = 1;
  while (T--) {
    init();
    read();
    solve();
    write();
  }
  return 0;
}
