#include <bits/stdc++.h>
char input[1000][1001];
int linelen[1000];
int main() {
  int maxlen = 0;
  int linecnt;
  for (linecnt = 0; gets(input[linecnt]); linecnt++) {
    linelen[linecnt] = strlen(input[linecnt]);
    if (maxlen < linelen[linecnt]) maxlen = linelen[linecnt];
  }
  for (int i = 0; i < maxlen + 2; i++) putchar('*');
  putchar('\n');
  int b_alignleft = 1;
  for (int i = 0; i < linecnt; i++) {
    putchar('*');
    int spaces = maxlen - linelen[i];
    for (int j = 0; j < spaces / 2; j++) putchar(' ');
    if (spaces % 2 && !b_alignleft) putchar(' ');
    printf("%s", input[i]);
    if (spaces % 2 && b_alignleft) putchar(' ');
    for (int j = 0; j < spaces / 2; j++) putchar(' ');
    puts("*");
    if (spaces % 2) b_alignleft = !b_alignleft;
  }
  for (int i = 0; i < maxlen + 2; i++) putchar('*');
  putchar('\n');
  return 0;
}
