#include <bits/stdc++.h>
using namespace std;
struct point {
  size_t x;
  size_t y;
};
enum Pixel {
  WHITE,
  BLACK,
  GUESS_WHITE,
};
bool isOnSquare(point min, point max, point check) {
  if (((check.x == min.x || check.x == max.x) && check.y >= min.y &&
       check.y <= max.y) ||
      ((check.y == min.y || check.y == max.y) && check.x >= min.x &&
       check.x <= max.x)) {
    return true;
  } else {
    return false;
  }
}
void exec(istream& in, ostream& out) {
  size_t n = 0, m = 0;
  in >> n >> m;
  vector<vector<Pixel>> display(m, vector<Pixel>(n, Pixel::BLACK));
  list<point> border(0);
  char cur_pix_char = 0;
  for (size_t i = 0; i < n; ++i) {
    for (size_t j = 0; j < m; ++j) {
      in >> cur_pix_char;
      if (cur_pix_char == '.') {
        display[j][i] = Pixel::BLACK;
      } else {
        display[j][i] = Pixel::WHITE;
        border.push_back(point({j, i}));
      }
    }
  }
  point min = {m, n}, max = {0, 0};
  for (auto p : border) {
    if (p.x < min.x) min.x = p.x;
    if (p.x > max.x) max.x = p.x;
    if (p.y < min.y) min.y = p.y;
    if (p.y > max.y) max.y = p.y;
  }
  size_t length =
      (max.x - min.x > max.y - min.y) ? max.x - min.x : max.y - min.y;
  if (n < length || m < length) {
    out << "-1" << endl;
    return;
  }
  list<pair<point, point>> squires(0);
  if (max.x - min.x == max.y - min.y) squires.push_back({min, max});
  if (max.x - min.x < length) {
    size_t len_left = length - (max.x - min.x);
    if (min.x >= len_left) {
      squires.push_back(
          {point({min.x - len_left, min.y}), point({max.x, max.y})});
    }
    if (max.x < m - len_left) {
      squires.push_back(
          {point({min.x, min.y}), point({max.x + len_left, max.y})});
    }
    if (min.x + m - max.x <= len_left) {
      out << "-1" << endl;
      return;
    }
    if (min.x + m - max.x > len_left) {
      squires.push_back(
          {point({0, min.y}), point({max.x + len_left - min.x, max.y})});
    }
  }
  if (max.y - min.y < length) {
    size_t len_left = length - (max.y - min.y);
    if (min.y >= len_left) {
      squires.push_back(
          {point({min.x, min.y - len_left}), point({max.x, max.y})});
    } else if (max.y < n - len_left) {
      squires.push_back(
          {point({min.x, min.y}), point({max.x, max.y + len_left})});
    } else if (min.y + n - max.y <= len_left) {
      out << "-1" << endl;
      return;
    } else {
      squires.push_back(
          {point({min.x, 0}), point({max.x, max.y - min.y + len_left})});
    }
  }
  bool fail = true;
  for (auto& s : squires) {
    fail = false;
    for (auto i : border) {
      if (!isOnSquare(s.first, s.second, i)) {
        fail = true;
      }
    }
    if (!fail) {
      min = s.first;
      max = s.second;
      break;
    }
  }
  if (fail) {
    out << "-1" << endl;
    return;
  }
  for (size_t i = 0; i < n; ++i) {
    for (size_t j = 0; j < m; ++j) {
      if (display[j][i] == Pixel::WHITE)
        out << 'w';
      else if (isOnSquare(min, max, point({j, i}))) {
        out << '+';
        display[j][i] = Pixel::GUESS_WHITE;
      } else {
        out << '.';
      }
    }
    out << endl;
  }
}
void test();
int main(int argc, char** argv) {
  string test_str = "test";
  if (argc == 2 && test_str == argv[1])
    test();
  else
    exec(cin, cout);
  return 0;
}
void test() {
  ifstream in("../D.txt");
  size_t i = 1;
  while (in.peek() != EOF) {
    stringstream ss("");
    string test_true = "";
    string test_real = "";
    bool pass = true;
    exec(in, ss);
    while (true) {
      in >> test_true;
      ss >> test_real;
      if (test_true == "TEST_FINISH") break;
      if (test_true != test_real) {
        cout << i << ":\tFAIL found " << test_real << " instead of "
             << test_true << endl;
        pass = false;
      }
    }
    if (pass) cout << i << ":\tPASS" << endl;
    ++i;
  }
}
