#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
const int INF = 0x3fffffff;
char s[1010][1010];
int main() {
  int n = 0;
  int m = 0;
  while (gets(s[n])) {
    m = max(m, (int)strlen(s[n]));
    n++;
  }
  for (int i = 0; i < m + 2; i++) putchar('*');
  puts("");
  int flag = 0;
  for (int i = 0; i < n; i++) {
    putchar('*');
    int k = strlen(s[i]);
    int a = (m - k) / 2;
    if ((m - k) % 2 == 1) {
      if (flag == 1) {
        a++;
        flag = 0;
      } else {
        flag = 1;
      }
    }
    for (int j = 0; j < a; j++) putchar(' ');
    printf("%s", s[i]);
    for (int j = 0; j < m - k - a; j++) putchar(' ');
    putchar('*');
    puts("");
  }
  for (int i = 0; i < m + 2; i++) putchar('*');
  puts("");
  return 0;
}
