#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[1010];
  int n = 0, l = 0;
  while (getline(cin, s[n])) {
    if (s[n].length() > l) l = s[n].length();
    n++;
  }
  for (int i = 0; i < l + 2; i++) {
    cout << '*';
  }
  cout << endl;
  int flag = 0;
  for (int i = 0; i < n; i++) {
    int x = l - s[i].length();
    int y = x / 2;
    int z = x - y;
    cout << '*';
    if (x % 2 == 0) {
      for (int k = 0; k < y; k++) cout << ' ';
      cout << s[i];
      for (int k = 0; k < z; k++) cout << ' ';
    } else if (x % 2 != 0 && flag == 0) {
      for (int k = 0; k < y; k++) cout << ' ';
      cout << s[i];
      for (int k = 0; k < z; k++) cout << ' ';
      flag = 1;
    } else if (x % 2 != 0 && flag == 1) {
      for (int k = 0; k < z; k++) cout << ' ';
      cout << s[i];
      for (int k = 0; k < y; k++) cout << ' ';
      flag = 0;
    }
    cout << '*' << endl;
  }
  for (int i = 0; i < l + 2; i++) {
    cout << '*';
  }
  cout << endl;
  return 0;
}
