#include <bits/stdc++.h>
using namespace std;
string s[1005];
char ch[1005];
int n = 0, Max = 0;
bool flag = 0;
void print(int x) {
  int len = s[x].size();
  if ((Max - len) % 2 == 0) {
    printf("*");
    for (int i = 1; i <= (Max - len) / 2; ++i) printf(" ");
    cout << s[x];
    for (int i = 1; i <= (Max - len) / 2; ++i) printf(" ");
    printf("*");
  }
  if ((Max - len) % 2 == 1) {
    printf("*");
    if (!flag) {
      for (int i = 1; i <= (Max - len) / 2; ++i) printf(" ");
      cout << s[x];
      for (int i = 1; i <= (Max - len) / 2 + 1; ++i) printf(" ");
      flag = !flag;
    } else {
      for (int i = 1; i <= (Max - len) / 2 + 1; ++i) printf(" ");
      cout << s[x];
      for (int i = 1; i <= (Max - len) / 2; ++i) printf(" ");
      flag = !flag;
    }
    printf("*");
  }
  printf("\n");
}
int main() {
  while (cin.getline(ch, 1005)) {
    s[n] = ch;
    if (s[n].size() > Max) Max = s[n].size();
    ++n;
  }
  for (int i = 1; i <= Max + 2; ++i) printf("*");
  printf("\n");
  for (int i = 0; i < n; ++i) print(i);
  for (int i = 1; i <= Max + 2; ++i) printf("*");
  printf("\n");
  return 0;
}
