#include <bits/stdc++.h>
using namespace std;
void print(int n) {
  for (int i = 0; i < n; i++) printf(" ");
}
int len[1234];
char s[1234][1234];
int mx = 0;
int main() {
  int n = 0;
  while (gets(s[n]) != NULL) {
    n++;
  }
  for (int i = 0; i < n; i++) {
    len[i] = strlen(s[i]);
    mx = max(mx, len[i]);
  }
  int k = 0;
  for (int i = 0; i <= mx + 1; i++) printf("*");
  printf("\n");
  for (int i = 0; i < n; i++) {
    if ((mx - len[i]) & 1) {
      k ^= 1;
      printf("*");
      if (k)
        print((mx - len[i]) / 2);
      else
        print((mx - len[i] + 1) / 2);
      printf("%s", s[i]);
      if (k == 0)
        print((mx - len[i]) / 2);
      else
        print((mx - len[i] + 1) / 2);
      printf("*\n");
    } else {
      printf("*");
      print((mx - len[i]) / 2);
      printf("%s", s[i]);
      print((mx - len[i] + 1) / 2);
      printf("*\n");
    }
  }
  for (int i = 0; i <= mx + 1; i++) printf("*");
  return 0;
}
