#include <bits/stdc++.h>
using namespace std;
template <class T>
T power(T a, T b) {
  T x;
  if (b == 0)
    x = 1;
  else
    x = a;
  for (size_t i = 1; i < b; i++) x *= a;
  return x;
}
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int n, m, a, b, c, ab, ba, x, y, z, avg, sum;
int arr3[1000001], arr4[200001], arr5[100001];
bool f, f1, f2;
string str, s1, s2, s3, s4;
set<int> seto;
double d, d1;
long long int x1, x2, y11, y2;
int mini = 1 << 30, maxi = 0;
vector<int> v;
stack<int> s;
string arr[1001];
void print(string str, bool f) {
  if (f)
    for (int j = 0; j < (maxi - str.size()) / 2 + 1; j++) cout << ' ';
  else
    for (int j = 0; j < (maxi - str.size()) / 2; j++) cout << ' ';
}
int main() {
  while (getline(cin, str)) {
    arr[x++] = str;
    maxi = max(maxi, (int)str.size());
  }
  if (maxi & 1) f = 1;
  for (int i = 0; i < maxi + 2; i++) cout << '*';
  cout << endl;
  for (int i = 0; i < x; i++) {
    cout << '*';
    if ((!f && arr[i].size() & 1) || (f && !(arr[i].size() & 1))) {
      print(arr[i], f1);
      cout << arr[i];
      print(arr[i], 1 - f1);
      f1 = 1 - f1;
    } else {
      print(arr[i], 0);
      cout << arr[i];
      print(arr[i], 0);
    }
    cout << '*' << endl;
  }
  for (int i = 0; i < maxi + 2; i++) cout << '*';
}
