#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
string str[N];
int main() {
  int n;
  int m = 0;
  for (n = 0; getline(cin, str[n]); n++) m = max(m, (int)str[n].length());
  for (int i = 0; i < m + 2; i++) cout << '*';
  cout << endl;
  int z = 1;
  int sp[3];
  for (int i = 0; i < n; i++) {
    cout << '*';
    sp[2] = (m - str[i].length());
    sp[1] = sp[2] / 2 + sp[2] % 2;
    sp[0] = sp[2] / 2;
    if (sp[1] != sp[0]) z = 1 - z;
    for (int j = 0; j < sp[z]; j++) cout << ' ';
    cout << str[i];
    for (int j = 0; j < sp[1 - z]; j++) cout << ' ';
    cout << '*' << endl;
  }
  for (int i = 0; i < m + 2; i++) cout << '*';
  cout << endl;
  return 0;
}
