#include <bits/stdc++.h>
using namespace std;
char str[1010][1010];
int main(void) {
  int n = 0, maxn = 0, len, flag = -1;
  while (gets(str[n]) != nullptr) {
    len = strlen(str[n++]);
    maxn = max(len, maxn);
  }
  for (int i = 0; i < maxn + 2; i++) printf("*");
  printf("\n");
  for (int i = 0; i < n; i++) {
    len = strlen(str[i]);
    int t = maxn - len, a, b;
    if (t % 2 == 0)
      a = b = t / 2;
    else {
      a = t / 2;
      b = a + 1;
      if (flag == 1) swap(a, b);
      flag = -flag;
    }
    printf("*");
    for (int j = 0; j < a; j++) printf(" ");
    for (int j = 0; j < len; j++) printf("%c", str[i][j]);
    for (int j = 0; j < b; j++) printf(" ");
    printf("*\n");
  }
  for (int i = 0; i < maxn + 2; i++) printf("*");
  printf("\n");
  return 0;
}
