#include <bits/stdc++.h>
using namespace std;
int a[2005][2005], b[2005][2005];
char c[2005][2005];
int main() {
  int n, m, sl = 2e9, sr = -2e9, u = 0, d = 0, sum = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x = 0, y = 0;
    for (int j = 1; j <= m; j++) {
      cin >> c[i][j];
      if (c[i][j] == 'w') {
        if (!x) x = j;
        y = j;
        sum++;
      }
    }
    if (x) {
      sl = min(sl, x);
      sr = max(sr, y);
      if (!u) u = i;
      d = i;
    }
  }
  for (int j = 1; j <= m; j++) {
    b[0][j] = 0;
    for (int i = 1; i <= n; i++) {
      b[i][j] = b[i - 1][j];
      if (c[i][j] == 'w') b[i][j]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    a[i][0] = 0;
    for (int j = 1; j <= m; j++) {
      a[i][j] = a[i][j - 1];
      if (c[i][j] == 'w') a[i][j]++;
    }
  }
  int len = max(sr - sl + 1, d - u + 1);
  if (len == 1) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cout << c[i][j];
      }
      cout << endl;
    }
    return 0;
  }
  for (int l = 1; l + len - 1 <= m; l++) {
    int r = l + len - 1;
    for (int i = 1; i + len - 1 <= n; i++) {
      int v = a[i][r] - a[i][l - 1] + a[i + len - 1][r] - a[i + len - 1][l - 1];
      v += b[i + len - 1][l] - b[i - 1][l] + b[i + len - 1][r] - b[i - 1][r];
      v -= (c[i][l] == 'w') + (c[i + len - 1][l] == 'w') +
           (c[i + len - 1][r] == 'w') + (c[i][r] == 'w');
      if (v == sum) {
        for (int j = i; j <= i + len - 1; j++) {
          if (c[j][l] == '.') c[j][l] = '+';
          if (c[j][r] == '.') c[j][r] = '+';
        }
        for (int j = l; j <= r; j++) {
          if (c[i][j] == '.') c[i][j] = '+';
          if (c[i + len - 1][j] == '.') c[i + len - 1][j] = '+';
        }
        for (int j = 1; j <= n; j++) {
          for (int k = 1; k <= m; k++) {
            cout << c[j][k];
          }
          cout << endl;
        }
        return 0;
      }
    }
  }
  cout << -1 << endl;
}
