#include <bits/stdc++.h>
using namespace std;
struct _nl {
} nl;
bool _ns = 0;
template <typename T>
void _p(const T &_) {
  if constexpr (is_same<T, _nl>()) {
    cout << "\n";
    _ns = 0;
  } else {
    if (_ns) cout << " ";
    cout << _;
    _ns = 1;
  }
}
template <typename... T>
void out(const T &..._) {
  (_p(_), ...);
}
int ii() {
  int _;
  cin >> _;
  return _;
}
vector<string> read_grid(int w, int h) {
  string s;
  vector<string> res;
  for (int i = 0; i < h; i++) {
    cin >> s;
    res.emplace_back(s);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int r = ii();
  int c = ii();
  auto grid = read_grid(c, r);
  int xmin = INT_MAX;
  int xmax = INT_MIN;
  int ymin = INT_MAX;
  int ymax = INT_MIN;
  for (int x = 0; x < c; x++) {
    for (int y = 0; y < r; y++) {
      if (grid[y][x] == 'w') {
        xmin = min(xmin, x);
        xmax = max(xmax, x);
        ymin = min(ymin, y);
        ymax = max(ymax, y);
      }
    }
  }
  auto validate = [&]() {
    bool ok = true;
    for (int x = 0; x < c; x++)
      for (int y = 0; y < r; y++) {
        if (grid[y][x] == 'w') {
          if (x != xmin && x != xmax && y != ymin && y != ymax) ok = false;
        }
      }
    return ok;
  };
  auto fill = [&]() {
    for (int x = xmin; x <= xmax; x++) {
      if (grid[ymin][x] == '.') grid[ymin][x] = '+';
      if (grid[ymax][x] == '.') grid[ymax][x] = '+';
    }
    for (int y = ymin; y <= ymax; y++) {
      if (grid[y][xmin] == '.') grid[y][xmin] = '+';
      if (grid[y][xmax] == '.') grid[y][xmax] = '+';
    }
  };
  bool ok = true;
  if (xmax - xmin < ymax - ymin) {
    int dbl_ix = -1;
    for (int y = ymin + 1; y < ymax; y++) {
      for (int x = xmin; x <= xmax; x++) {
        if (grid[y][x] == 'w') {
          if (dbl_ix != -1 && dbl_ix != x)
            ok = false;
          else
            dbl_ix = x;
        }
      }
    }
    if (dbl_ix != -1) {
      if (dbl_ix == xmin) {
        int xmax0 = xmax;
        xmax = dbl_ix + ymax - ymin;
        if (xmax >= c) {
          xmax = xmax0;
          if (xmin == xmax) {
            xmin = xmax - ymax + ymin;
            if (xmin < 0) ok = false;
          } else
            ok = false;
        }
      } else if (dbl_ix == xmax) {
        xmin = xmax - ymax + ymin;
        if (xmin < 0) ok = false;
      }
    } else {
      int delta = ymax - ymin - (xmax - xmin);
      xmin -= delta;
      if (xmin < 0) {
        xmax -= xmin;
        xmin = 0;
      }
      if (xmax >= c) ok = false;
    }
  } else if (xmax - xmin > ymax - ymin) {
    int dbl_ix = -1;
    for (int x = xmin + 1; x < xmax; x++) {
      for (int y = ymin; y <= ymax; y++) {
        if (grid[y][x] == 'w') {
          if (dbl_ix != -1 && dbl_ix != y)
            ok = false;
          else
            dbl_ix = y;
        }
      }
    }
    if (dbl_ix != -1) {
      if (dbl_ix == ymin) {
        int ymax0 = ymax;
        ymax = dbl_ix + xmax - xmin;
        if (ymax >= r) {
          ymax = ymax0;
          if (ymin == ymax) {
            ymin = ymax - xmax + xmin;
            if (ymin < 0) ok = false;
          } else
            ok = false;
        }
      } else if (dbl_ix == ymax) {
        ymin = ymax - xmax + xmin;
        if (ymin < 0) ok = false;
      }
    } else {
      int delta = xmax - xmin - (ymax - ymin);
      ymin -= delta;
      if (ymin < 0) {
        ymax -= ymin;
        ymin = 0;
      }
      if (ymax >= r) ok = false;
    }
  }
  if (!ok) {
    out(-1, nl);
  } else {
    if (!validate()) {
      out(-1, nl);
    } else {
      fill();
      for (auto &s : grid) out(s, nl);
    }
  }
  return 0;
}
