#include <bits/stdc++.h>
using namespace std;
int n = 0;
char s[1010][1010];
int main() {
  int w = 0;
  while (gets(s[n])) {
    w = max(w, (int)strlen(s[n]));
    n++;
  }
  for (int i = 0; i < w + 2; i++) printf("*");
  printf("\n");
  int x = 0;
  for (int i = 0; i < n; i++) {
    printf("*");
    int k = strlen(s[i]);
    for (int j = 0; j < (w - k + x) / 2; j++) printf(" ");
    printf("%s", s[i]);
    for (int j = 0; j < (w - k + 1 - x) / 2; j++) printf(" ");
    if ((w - k) % 2 != 0) x = 1 - x;
    printf("*\n");
  }
  for (int i = 0; i < w + 2; i++) printf("*");
  printf("\n");
  return 0;
}
