#include <bits/stdc++.h>
using namespace std;
template <typename T>
using maxHeap = priority_queue<T, vector<T>, less<T>>;
template <typename T>
using minHeap = priority_queue<T, vector<T>, greater<T>>;
template <typename Iter>
ostream& _out(ostream& s, Iter b, Iter e) {
  s << "[";
  for (auto it = b; it != e; it++) s << (it == b ? "" : " ") << *it;
  s << "]";
  return s;
}
template <typename A, typename B>
ostream& operator<<(ostream& s, const pair<A, B>& p) {
  return s << "(" << p.first << "," << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, const vector<T>& c) {
  return _out(s, begin(c), end(c));
}
bool debug = 0;
template <typename T>
void DEBUG(const T& x) {
  if (debug) cerr << x;
}
template <typename T, typename... Args>
void DEBUG(const T& head, const Args&... tail) {
  if (debug) {
    cerr << head;
    DEBUG(tail...);
  }
}
const int N = 1000 + 5;
string str[N];
int main(int argc, char* argv[]) {
  if (argc > 1 and string(argv[1]) == "-D") debug = 1;
  if (!debug) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
  int n = 0, mx = 0;
  while (getline(cin, str[n])) {
    mx = max(mx, (int)(str[n].size()));
    n++;
  }
  for (int i = 0; i < mx + 2; i++) cout << '*';
  cout << '\n';
  bool flag = true;
  for (int i = 0; i < n; i++) {
    int sp = mx - (int)(str[i].size());
    cout << '*';
    for (int _ = 0; _ < sp / 2; _++) cout << ' ';
    if (sp & 1 and !flag) cout << ' ';
    cout << str[i];
    for (int _ = 0; _ < sp / 2; _++) cout << ' ';
    if (sp & 1 and flag) cout << ' ';
    cout << "*\n";
    flag ^= (sp & 1);
  }
  for (int i = 0; i < mx + 2; i++) cout << '*';
  return 0;
}
