#include <bits/stdc++.h>
using namespace std;
char str[1005][1005];
int len[1005];
int main(void) {
  int i, j, n = 0, maxx = 0, zero, a, b, delta = 0;
  while (cin.getline(str[++n], 1005)) {
    len[n] = strlen(str[n]);
    maxx = max(maxx, len[n]);
  }
  --n;
  for (i = 1; i <= maxx + 2; ++i) putchar('*');
  putchar('\n');
  for (i = 1; i <= n; ++i) {
    putchar('*');
    zero = maxx - len[i];
    if (zero % 2) {
      a = floor(zero / 2) + delta;
      b = floor(zero / 2) + (delta ^ 1);
      delta ^= 1;
    } else {
      a = floor(zero / 2);
      b = floor(zero / 2);
    }
    for (j = 1; j <= a; ++j) putchar(' ');
    printf("%s", str[i]);
    for (j = 1; j <= b; ++j) putchar(' ');
    putchar('*');
    putchar('\n');
  }
  for (i = 1; i <= maxx + 2; ++i) putchar('*');
  putchar('\n');
  return 0;
}
