#include <bits/stdc++.h>
using namespace std;
int n, m, a[2001][2001], u, d, l, r, s, ro[2001], co[2001],
    ou = 1, od = 1, ol = 1, oor = 1, ud, lr;
string st;
int main() {
  int i, j, f;
  f = 0;
  cin >> n >> m;
  for (i = 1; i <= n; i = i + 1) {
    cin >> st;
    for (j = 1; j <= m; j = j + 1) {
      if (st[j - 1] == 'w') {
        a[i][j] = 1;
        if (!f) {
          u = i;
          f = 1;
        }
        if (i > d) d = i;
      }
    }
  }
  f = 0;
  for (j = 1; j <= m; j = j + 1) {
    for (i = 1; i <= n; i = i + 1) {
      if (a[i][j]) {
        if (!f) {
          l = j;
          f = 1;
        }
        if (j > r) r = j;
      }
    }
  }
  for (i = 1; i <= n; i = i + 1) {
    for (j = 1; j <= m; j = j + 1) {
      if (a[i][j]) {
        ro[i]++;
        if (j != l && j != r && i != u && i != d) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }
  for (j = 1; j <= m; j = j + 1) {
    for (i = 1; i <= n; i = i + 1) {
      if (a[i][j]) {
        co[j]++;
        if (j != l && j != r && i != u && i != d) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }
  if (d - u + 1 > m || r - l + 1 > n) {
    cout << -1 << endl;
    return 0;
  }
  for (j = l; j <= r; j = j + 1) {
    if (a[u][j] && j != l && j != r) ou = 0;
    if (a[d][j] && j != l && j != r) od = 0;
  }
  for (i = u; i <= d; i = i + 1) {
    if (a[i][l] && i != u && i != d) ol = 0;
    if (a[i][r] && i != u && i != d) oor = 0;
  }
  if (u == d) {
    if (u > n - u + 1)
      ou = 1;
    else
      od = 1;
  }
  if (l == r) {
    if (l > m - l + 1)
      ol = 1;
    else
      oor = 1;
  }
  ud = d - u + 1;
  lr = r - l + 1;
  while (ud < lr && ou && u > 1) {
    u = u - 1;
    ud = ud + 1;
  }
  while (ud < lr && od && d < n) {
    d = d + 1;
    ud = ud + 1;
  }
  while (lr < ud && ol && l > 1) {
    l = l - 1;
    lr = lr + 1;
  }
  while (lr < ud && oor && r < m) {
    r = r + 1;
    lr = lr + 1;
  }
  if (ud != lr) {
    cout << -1 << endl;
    return 0;
  }
  for (i = u; i <= d; i = i + 1) {
    if (!a[i][l]) a[i][l] = 2;
    if (!a[i][r]) a[i][r] = 2;
  }
  for (j = l; j <= r; j = j + 1) {
    if (!a[u][j]) a[u][j] = 2;
    if (!a[d][j]) a[d][j] = 2;
  }
  for (i = 1; i <= n; i = i + 1) {
    for (j = 1; j <= m; j = j + 1) {
      if (!a[i][j]) {
        cout << '.';
      } else if (a[i][j] == 1) {
        cout << 'w';
      } else if (a[i][j] == 2) {
        cout << '+';
      }
    }
    cout << endl;
  }
  return 0;
}
