#include <bits/stdc++.h>
using namespace std;
string tmp, a;
queue<string> word;
int Max, n = 0;
int len, num = 0;
;
int main() {
  while (getline(cin, tmp)) {
    n++;
    if (Max < tmp.size()) Max = tmp.size();
    word.push(tmp);
  }
  for (int i = 0; i < Max + 2; i++) printf("*");
  printf("\n");
  for (int i = 0; i < n; i++) {
    printf("*");
    a = word.front();
    word.pop();
    int l = Max - a.size();
    int s = l / 2;
    if (l % 2 != 0) {
      num++;
      if (num % 2 != 0) {
        for (int j = 0; j < s; j++) printf(" ");
        cout << a;
        for (int j = 0; j < l - s; j++) printf(" ");
        printf("*\n");
      } else {
        for (int j = 0; j < l - s; j++) printf(" ");
        cout << a;
        for (int j = 0; j < s; j++) printf(" ");
        printf("*\n");
      }
    } else {
      for (int j = 0; j < s; j++) printf(" ");
      cout << a;
      for (int j = 0; j < l - s; j++) printf(" ");
      printf("*\n");
    }
  }
  for (int i = 0; i < Max + 2; i++) printf("*");
  return 0;
}
