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