#include <bits/stdc++.h>
using namespace std;
const int debug = 0;
int n, m;
char s[2010][2010];
int check(int mnr, int mnc, int mxr, int mxc) {
  int i, j, ans = 0;
  bool vis[2010][2010];
  memset(vis, 0, sizeof(vis));
  i = mnr;
  for (j = mnc; j <= mxc; ++j)
    if (s[i][j] == 'w' && !vis[i][j]) {
      vis[i][j] = 1;
      ans++;
    }
  i = mxr;
  for (j = mnc; j <= mxc; ++j)
    if (s[i][j] == 'w' && !vis[i][j]) {
      vis[i][j] = 1;
      ans++;
    }
  j = mnc;
  for (i = mnr; i <= mxr; ++i)
    if (s[i][j] == 'w' && !vis[i][j]) {
      vis[i][j] = 1;
      ans++;
    }
  j = mxc;
  for (i = mnr; i <= mxr; ++i)
    if (s[i][j] == 'w' && !vis[i][j]) {
      vis[i][j] = 1;
      ans++;
    }
  return ans;
}
void paint(int mnr, int mnc, int mxr, int mxc) {
  int i, j;
  i = mnr;
  for (j = mnc; j <= mxc; ++j)
    if (s[i][j] == '.') s[i][j] = '+';
  i = mxr;
  for (j = mnc; j <= mxc; ++j)
    if (s[i][j] == '.') s[i][j] = '+';
  j = mnc;
  for (i = mnr; i <= mxr; ++i)
    if (s[i][j] == '.') s[i][j] = '+';
  j = mxc;
  for (i = mnr; i <= mxr; ++i)
    if (s[i][j] == '.') s[i][j] = '+';
}
int main() {
  while (cin >> n >> m) {
    int i, j, sum = 0, mnr = 2010, mxr = -1, mnc = 2010, mxc = -1;
    for (i = 0; i < n; ++i) scanf("%s", s[i]);
    for (i = 0; i < n; ++i)
      for (j = 0; j < m; ++j) {
        if (s[i][j] == 'w') {
          sum++;
          mnr = min(mnr, i);
          mxr = max(mxr, i);
          mnc = min(mnc, j);
          mxc = max(mxc, j);
        }
      }
    int wc = mxc - mnc;
    bool found = 0;
    for (i = 0; i + wc < n; ++i)
      if (check(i, mnc, i + wc, mxc) == sum) {
        found = 1;
        break;
      }
    if (found) {
      paint(i, mnc, i + wc, mxc);
      for (i = 0; i < n; ++i) puts(s[i]);
      continue;
    }
    wc = mxr - mnr;
    for (j = 0; j + wc < m; ++j)
      if (check(mnr, j, mxr, j + wc) == sum) {
        found = 1;
        break;
      }
    if (found) {
      paint(mnr, j, mxr, j + wc);
      for (i = 0; i < n; ++i) puts(s[i]);
    } else
      puts("-1");
  }
  return 0;
}
