#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  char c[2000];
  cin >> n >> m;
  set<pair<int, int> > w;
  for (int i = 0; i < n; i++) {
    cin >> c;
    for (int j = 0; j < m; j++) {
      if (c[j] == 'w') w.insert(make_pair(i, j));
    }
  }
  int coner[4] = {2001, -1, 2001, -1};
  for (set<pair<int, int> >::iterator i = w.begin(); i != w.end(); i++) {
    coner[0] = min(coner[0], i->first);
    coner[1] = max(coner[1], i->first);
    coner[2] = min(coner[2], i->second);
    coner[3] = max(coner[3], i->second);
  }
  int d = 2001;
  if (coner[3] - coner[2] > coner[1] - coner[0]) {
    if (coner[0] + coner[3] - coner[2] < n) {
      int c1t = coner[1];
      coner[1] = coner[0] + coner[3] - coner[2];
      for (set<pair<int, int> >::iterator i = w.begin(); i != w.end(); i++) {
        if (i->first != coner[0] && i->first != coner[1] &&
            i->second != coner[2] && i->second != coner[3]) {
          d = 0;
          break;
        }
      }
      if (d == 0) {
        coner[1] = c1t;
        if (coner[1] - coner[3] + coner[2] >= 0) {
          coner[0] = coner[1] - coner[3] + coner[2];
        }
      }
    } else if (coner[1] - coner[3] + coner[2] >= 0) {
      coner[0] = coner[1] - coner[3] + coner[2];
    } else if (coner[3] - coner[2] < n) {
      int x = coner[3] - coner[2];
      coner[0] = x - coner[3] + coner[2];
      coner[1] = x;
    } else {
      d = -1;
    }
  } else {
    if (coner[2] + coner[1] - coner[0] < m) {
      int c3t = coner[3];
      coner[3] = coner[2] + coner[1] - coner[0];
      for (set<pair<int, int> >::iterator i = w.begin(); i != w.end(); i++) {
        if (i->first != coner[0] && i->first != coner[1] &&
            i->second != coner[2] && i->second != coner[3]) {
          d = 0;
          break;
        }
      }
      if (d == 0) {
        coner[3] = c3t;
        if (coner[3] - coner[1] + coner[0] >= 0) {
          coner[2] = coner[3] - coner[1] + coner[0];
        }
      }
    } else if (coner[3] - coner[1] + coner[0] >= 0) {
      coner[2] = coner[3] - coner[1] + coner[0];
    } else if (coner[1] - coner[0] < m) {
      int x = coner[1] - coner[0];
      coner[2] = x - coner[1] + coner[0];
      coner[3] = x;
    } else {
      d = -1;
    }
  }
  if (coner[3] - coner[2] != coner[1] - coner[0]) d = -1;
  for (set<pair<int, int> >::iterator i = w.begin(); i != w.end(); i++) {
    if (i->first != coner[0] && i->first != coner[1] && i->second != coner[2] &&
        i->second != coner[3])
      d = -1;
  }
  if (d >= 0) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (((i == coner[0] || i == coner[1]) && j >= coner[2] &&
             j <= coner[3]) ||
            ((j == coner[2] || j == coner[3]) && i >= coner[0] &&
             i <= coner[1])) {
          if (w.find(make_pair(i, j)) == w.end()) {
            cout << '+';
          } else {
            cout << 'w';
          }
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
  } else {
    cout << -1 << endl;
  }
  return 0;
}
