#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int maxn = 2005;
const int INF = (int)1e9;
char s[maxn][maxn];
int n, m;
void print(int miX, int maX, int miY, int maY) {
  for (int i = miX; i <= maX; i++) {
    if (s[i][miY] == '.') {
      s[i][miY] = '+';
    }
    if (s[i][maY] == '.') {
      s[i][maY] = '+';
    }
  }
  for (int j = miY; j <= maY; j++) {
    if (s[miX][j] == '.') {
      s[miX][j] = '+';
    }
    if (s[maX][j] == '.') {
      s[maX][j] = '+';
    }
  }
  for (int i = 0; i < n; i++) {
    cout << s[i] << endl;
  }
  exit(0);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  int miX = INF, maX = -INF, miY = INF, maY = -INF;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
      if (s[i][j] == 'w') {
        miX = min(miX, i);
        maX = max(maX, i);
        miY = min(miY, j);
        maY = max(maY, j);
      }
  }
  for (int i = miX + 1; i < maX; i++) {
    for (int j = miY + 1; j < maY; j++) {
      if (s[i][j] == 'w') {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  if (maX - miX == maY - miY) {
    print(miX, maX, miY, maY);
  }
  if (maX - miX > maY - miY) {
    if (maY == miY) {
      int add = maX - miX - (maY - miY);
      if (miY >= add) print(miX, maX, miY - add, maY);
      if (maY + add < m) print(miX, maX, miY, maY + add);
    }
    bool lf = false;
    bool rg = false;
    for (int i = miX + 1; i < maX; i++) {
      if (s[i][miY] == 'w') lf = true;
      if (s[i][maY] == 'w') rg = true;
    }
    if (lf && rg) {
      cout << -1 << endl;
      return 0;
    }
    int add = maX - miX - (maY - miY);
    if (lf && maY + add >= m) {
      cout << -1 << endl;
      return 0;
    }
    if (lf && maY + add < m) {
      print(miX, maX, miY, maY + add);
    }
    if (rg && miY - add < 0) {
      cout << -1 << endl;
      return 0;
    }
    if (rg && miY - add >= 0) {
      print(miX, maX, miY - add, maY);
    }
    if (maX - miX + 1 > m || lf || rg) {
      cout << -1 << endl;
      return 0;
    }
    if (miY >= add) {
      print(miX, maX, miY - add, maY);
    } else {
      print(miX, maX, 0, maY + (add - miY));
    }
  } else {
    if (maX == miX) {
      int add = maY - miY - (maX - miX);
      if (miX >= add) print(miX - add, maX, miY, maY);
      if (maX + add < n) print(miX, maX + add, miY, maY);
    }
    bool lf = false;
    bool rg = false;
    for (int j = miY + 1; j < maY; j++) {
      if (s[miX][j] == 'w') lf = true;
      if (s[maX][j] == 'w') rg = true;
    }
    if (lf && rg) {
      cout << -1 << endl;
      return 0;
    }
    int add = maY - miY - (maX - miX);
    if (lf && maX + add >= n) {
      cout << -1 << endl;
      return 0;
    }
    if (lf && maX + add < n) {
      print(miX, maX + add, miY, maY);
    }
    if (rg && miX - add < 0) {
      cout << -1 << endl;
      return 0;
    }
    if (rg && miX - add >= 0 || lf || rg) {
      print(miX - add, maX, miY, maY);
    }
    if (maY - miY + 1 > n) {
      cout << -1 << endl;
      return 0;
    }
    if (miX >= add) {
      print(miX - add, maX, miY, maY);
    } else {
      print(0, maX + (add - miX), miY, maY);
    }
  }
  cout << -1 << endl;
  return 0;
}
