#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-12;
const int inf = 1e9;
char a[2300][2300];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) scanf("%s", a[i]);
  int l = inf, r = -inf, u = inf, d = -inf;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == 'w') {
        l = min(l, j);
        r = max(r, j);
        u = min(u, i);
        d = max(d, i);
      }
  if (l == inf) {
    cout << -1 << endl;
    return 0;
  }
  bool L = 0, R = 0, U = 0, D = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (i == u && j > l && j < r && a[i][j] == 'w') U = 1;
      if (i == d && j > l && j < r && a[i][j] == 'w') D = 1;
      if (j == l && i > u && i < d && a[i][j] == 'w') L = 1;
      if (j == r && i > u && i < d && a[i][j] == 'w') R = 1;
    }
  int s = max(r - l, d - u);
  if (l == r || u == d) {
    if (l == r) {
      if (r - s >= 0)
        l = r - s;
      else if (l + s < m)
        r = l + s;
      else if (L || R) {
        cout << -1 << endl;
        return 0;
      } else {
        l = max(0, r - s);
        r = min(m - 1, l + s);
        if (r - l != s) {
          cout << -1 << endl;
          return 0;
        }
      }
    } else {
      if (d - s >= 0)
        u = d - s;
      else if (u + s < n)
        d = u + s;
      else if (U || D) {
        cout << -1 << endl;
        return 0;
      } else {
        u = max(0, d - s);
        d = min(n - 1, u + s);
        if (d - u != s) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  } else {
    if (U && D && d - u != s) {
      cout << -1 << endl;
      return 0;
    }
    if (L && R && r - l != s) {
      cout << -1 << endl;
      return 0;
    }
    if (U && d - u != s) d = s + u;
    if (D && d - u != s) u = d - s;
    if (L && r - l != s) r = l + s;
    if (R && r - l != s) l = r - s;
    if (!U && !D && d - u != s) {
      u = max(0, d - s);
      d = min(n - 1, u + s);
    }
    if (!L && !R && r - l != s) {
      l = max(0, r - s);
      r = min(m - 1, l + s);
    }
    if (u < 0 || l < 0 || d >= n || r >= m) {
      cout << -1 << endl;
      return 0;
    }
    if (d - u != s || r - l != s) {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if ((i == u || i == d) && j >= l && j <= r) {
        if (a[i][j] != 'w') a[i][j] = '+';
      } else if (i >= u && i <= d && (j == l || j == r)) {
        if (a[i][j] != 'w') a[i][j] = '+';
      } else if (a[i][j] == 'w') {
        cout << -1 << endl;
        return 0;
      }
    }
  for (int i = 0; i < n; i++) printf("%s\n", a[i]);
  return 0;
}
