#include <bits/stdc++.h>
const long long inf = 0x3f3f3f3f3f3f3f3LL;
const long long mod = (long long)1e9 + 7;
using namespace std;
template <class T, class T2>
void smin(T& a, T2 val) {
  if (a > val) a = val;
}
template <class T, class T2>
void smax(T& a, T2 val) {
  if (a < val) a = val;
}
const long long N = 2e3 + 100;
long long n, m;
char a[N][N];
long long pref[N][N];
long long sum(long long x1, long long y1, long long x2, long long y2) {
  if (x1 > x2 or y1 > y2) {
    return 0;
  }
  long long total = pref[x2][y2];
  total -= pref[x2][y1 - 1];
  total -= pref[x1 - 1][y2];
  total += pref[x1 - 1][y1 - 1];
  ;
  return total;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      cin >> a[i][j];
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      pref[i][j] = pref[i][j - 1];
      pref[i][j] += (a[i][j] == 'w');
    }
  }
  for (long long j = 1; j <= m; ++j) {
    for (long long i = 1; i <= n; ++i) {
      pref[i][j] += pref[i - 1][j];
    }
  }
  long long xmin = inf, xmax = -inf;
  long long ymin = inf, ymax = -inf;
  long long whites = 0;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      if (a[i][j] == 'w') {
        whites++;
        smin(xmin, i);
        smin(ymin, j);
        smax(xmax, i);
        smax(ymax, j);
      }
    }
  };
  long long length = max(xmax - xmin + 1, ymax - ymin + 1);
  bool good = false;
  vector<long long> v;
  long long x1, x2, y1, y2;
  for (long long i : {xmin, max(1LL, xmax - length + 1)}) {
    for (long long j : {ymin, max(1LL, ymax - length + 1)}) {
      long long ni = i + length - 1;
      long long nj = j + length - 1;
      ;
      if (i <= 0 or j <= 0 or i > n or j > m) continue;
      if (ni <= 0 or nj <= 0 or ni > n or nj > m) continue;
      ;
      long long total = sum(i, j, ni, nj);
      total -= sum(i + 1, j + 1, ni - 1, nj - 1);
      ;
      if (total == whites) {
        x1 = i, x2 = ni;
        y1 = j, y2 = nj;
        good = true;
        break;
      }
    }
  }
  if (!good) {
    cout << -1;
    exit(0);
  }
  for (long long i = x1; i <= x2; ++i) {
    for (long long j = y1; j <= y2; ++j) {
      if (a[i][j] != 'w' and (i == x1 or i == x2 or j == y1 or j == y2)) {
        a[i][j] = '+';
      }
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      cout << a[i][j];
    }
    cout << '\n';
  }
  return 0;
}
