#include <bits/stdc++.h>
using namespace std;
static int toggle = 0;
void printAligned(const string line, const size_t len) {
  cout << "*";
  if (line.size() % 2 == len % 2) {
    int diff = (len - 2) - line.size();
    for (size_t i = 0; i < diff / 2; i++) cout << " ";
    for (size_t i = 0; i < line.size(); i++) cout << line[i];
    for (size_t i = 0; i < diff / 2; i++) cout << " ";
  } else {
    int diff = (len - 2) - line.size();
    int a, b;
    a = b = diff / 2;
    if (toggle == 0) {
      b++;
      toggle = 1;
    } else {
      a++;
      toggle = 0;
    }
    for (int i = 0; i < a; i++) cout << " ";
    for (size_t i = 0; i < line.size(); i++) cout << line[i];
    for (int i = 0; i < b; i++) cout << " ";
  }
  cout << "*" << endl;
}
int main(int argc, char *argv[]) {
  vector<string> lines;
  string line;
  size_t maxline = 0;
  while (getline(cin, line)) {
    lines.push_back(line);
    maxline = max(maxline, line.size());
  }
  int size = maxline + 2;
  for (int i = 0; i < size; i++) cout << "*";
  cout << endl;
  for (int i = 0; i < lines.size(); i++) printAligned(lines[i], size);
  for (int i = 0; i < size; i++) cout << "*";
  cout << endl;
  return 0;
}
