#include <bits/stdc++.h>
using namespace std;
char s[1010][1010];
int cnt, len[1010], maxlen;
bool flag;
int main() {
  cnt = flag = 0;
  while (gets(s[cnt])) {
    len[cnt] = strlen(s[cnt]);
    maxlen = max(maxlen, len[cnt]);
    cnt++;
  }
  for (int i = 0; i < maxlen + 2; i++) putchar('*');
  putchar('\n');
  for (int i = 0; i < cnt; i++) {
    putchar('*');
    for (int j = 0; j < (maxlen - len[i] + flag) / 2; j++) putchar(' ');
    if ((maxlen - len[i]) & 1) flag ^= 1;
    printf("%s", s[i]);
    for (int j = 0; j < (maxlen - len[i] + flag) / 2; j++) putchar(' ');
    putchar('*');
    putchar('\n');
  }
  for (int i = 0; i < maxlen + 2; i++) putchar('*');
  putchar('\n');
  return 0;
}
