#include <bits/stdc++.h>
using namespace std;
string pal, arr[100088];
int maxi = 0;
int main() {
  int t = 0;
  int u = 7;
  while (getline(cin, arr[t])) {
    maxi = max(maxi, (int)arr[t].size());
    t++;
  }
  for (int i = 0; i < maxi + 2; i++) {
    printf("*");
  }
  printf("\n");
  bool b1 = true;
  for (int i = 0; i < t; i++) {
    int c = 1;
    printf("*");
    int x = (maxi - arr[i].size() + 1) / 2;
    if (arr[i].size() + x + x != maxi) {
      if (b1 == true) {
        x--;
        b1 = false;
      } else {
        b1 = true;
      }
    }
    for (int j = 0; j < x; j++) {
      printf(" ");
      c++;
    }
    cout << arr[i];
    int m = (int)arr[i].size();
    c += m;
    for (int j = c; j <= maxi; j++) {
      printf(" ");
    }
    printf("*\n");
  }
  for (int i = 0; i < maxi + 2; i++) {
    printf("*");
  }
  return 0;
}
