#include <bits/stdc++.h>
using namespace std;
string a[2005];
set<int> x, y;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int r1 = 1e9, r2 = -1, c1 = 1e9, c2 = -1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 'w') {
        r1 = min(r1, i);
        r2 = max(r1, i);
        c1 = min(c1, j);
        c2 = max(c2, j);
        x.insert(i);
        y.insert(j);
      }
    }
  }
  int ans = 0;
  if (abs(r1 - r2) > abs(c1 - c2)) {
    for (int i = 0; i < m - abs(r1 - r2); i++) {
      int c11 = i;
      int c22 = i + abs(r1 - r2);
      set<int>::iterator it1 = y.upper_bound(c22);
      set<int>::iterator it2 = y.lower_bound(c11);
      if (it1 == y.end() && it2 == y.begin()) {
        bool f = true;
        for (int j = r1 + 1; j <= r2 - 1 && f; j++) {
          for (int k = c11 + 1; k <= c22 - 1 && f; k++) {
            if (a[j][k] == 'w') f = false;
          }
        }
        if (f) {
          c1 = c11;
          c2 = c22;
          break;
        }
      }
    }
  } else if (abs(c1 - c2) > abs(r1 - r2)) {
    for (int i = 0; i < n - abs(c1 - c2); i++) {
      int r11 = i;
      int r22 = i + abs(c1 - c2);
      set<int>::iterator it1 = x.upper_bound(r22);
      set<int>::iterator it2 = x.lower_bound(r11);
      if (it1 == x.end() && it2 == x.begin()) {
        bool f = true;
        for (int j = r11 + 1; j <= r22 - 1 && f; j++) {
          for (int k = c1 + 1; k <= c2 - 1 && f; k++) {
            if (a[j][k] == 'w') f = false;
          }
        }
        if (f) {
          r1 = r11;
          r2 = r22;
          break;
        }
      }
    }
  }
  for (int i = r1 + 1; i <= r2 - 1; i++) {
    for (int j = c1 + 1; j <= c2 - 1; j++) {
      if (a[i][j] == 'w') {
        ans = -1;
      }
    }
  }
  if (ans == -1 || abs(r1 - r2) != abs(c1 - c2)) {
    cout << -1 << endl;
  } else {
    for (int i = r1; i <= r2; i++) {
      if (a[i][c1] != 'w') a[i][c1] = '+';
      if (a[i][c2] != 'w') a[i][c2] = '+';
    }
    for (int i = c1; i <= c2; i++) {
      if (a[r1][i] != 'w') a[r1][i] = '+';
      if (a[r2][i] != 'w') a[r2][i] = '+';
    }
    for (int i = 0; i < n; i++) {
      cout << a[i] << endl;
    }
  }
  return 0;
}
