#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4786)
char mat[2002][2002];
int n, m, sum[2002][2002];
int i, j, flag, mnr, mxr, mnc, mxc, d, cc;
bool func(int mnr, int mnc, int mxr, int mxc) {
  if (mnr < 0 || mxr >= n || mnc < 0 || mxc >= m) return false;
  if (sum[mxr + 1][mxc + 1] - sum[mnr][mxc + 1] - sum[mxr + 1][mnc] +
          sum[mnr][mnc] !=
      cc)
    return false;
  if (d >= 2 && sum[mxr][mxc] - sum[mnr + 1][mxc] - sum[mxr][mnc + 1] +
                        sum[mnr + 1][mnc + 1] >=
                    1)
    return false;
  return true;
}
int main() {
  while (cin >> n >> m) {
    memset(sum, 0, sizeof(sum));
    for (i = 0; i < n; i++) cin >> mat[i];
    mnr = mnc = (1 << 29);
    mxr = mxc = -1;
    cc = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (mat[i][j] == 'w') {
          mnr = ((mnr) < (i) ? (mnr) : (i));
          mnc = ((mnc) < (j) ? (mnc) : (j));
          mxr = ((mxr) > (i) ? (mxr) : (i));
          mxc = ((mxc) > (j) ? (mxc) : (j));
          sum[i + 1][j + 1] = 1;
          cc++;
        }
        sum[i + 1][j + 1] += sum[i][j + 1];
        sum[i + 1][j + 1] += sum[i + 1][j];
        sum[i + 1][j + 1] -= sum[i][j];
      }
    }
    d = mxr - mnr;
    d = (((mxc - mnc)) > (d) ? ((mxc - mnc)) : (d));
    flag = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (i == 4 && j == 12) i = i;
        if (func(i, j, i + d, j + d)) {
          flag = 1;
          mnr = i;
          mnc = j;
          mxr = i + d;
          mxc = j + d;
          break;
        }
      }
      if (flag) break;
    }
    if (flag) {
      for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
          if (mat[i][j] == '.') {
            if ((i == mnr || i == mxr) && (j >= mnc && j <= mxc))
              mat[i][j] = '+';
            if ((i >= mnr && i <= mxr) && (j == mnc || j == mxc))
              mat[i][j] = '+';
          }
          cout << mat[i][j];
        }
        cout << endl;
      }
    } else
      cout << -1 << endl;
    cerr << endl;
  }
  return 0;
}
