#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int MAXN = 1e5 + 5;
const int MAXM = 2e6 + 5;
const int MOD = 1e9 + 7;
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
long long pw(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void inc(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
void dec(long long &a, long long b) {
  a -= b;
  if (a < 0) a += MOD;
}
int mul(int a, int b) {
  long long c = 1ll * a * b;
  return c - c / MOD * MOD;
}
int n, m;
char G[2005][2005];
int u, d, l, r;
bool ok() {
  if (d - u != r - l) return false;
  for (int i = u + 1; i < d; i++)
    for (int j = l + 1; j < r; j++) {
      if (G[i][j] == 'w') return false;
    }
  return true;
}
bool ok2(int on, int x) {
  if (on == 0) {
    for (int i = u + 1; i < d; i++)
      if (G[i][x] == 'w') return false;
  } else {
    for (int i = l + 1; i < r; i++)
      if (G[x][i] == 'w') return false;
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n + 1; i++) scanf("%s", G[i] + 1);
  u = d = l = r = -1;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < m + 1; j++) {
      if (G[i][j] == 'w') {
        if (u == -1)
          u = d = i, l = r = j;
        else {
          u = min(u, i);
          l = min(l, j);
          d = max(d, i);
          r = max(r, j);
        }
      }
    }
  if (d - u > r - l) {
    int t = (d - u) - (r - l);
    if (l == r) {
      if (ok2(0, l)) {
        if (t >= l - 1)
          t -= l - 1, l = 1;
        else
          l -= t, t = 0;
        if (t >= m - r)
          t -= m - r, r = m;
        else
          r += t, t = 0;
      } else {
        if (l - 1 >= m - r)
          if (t >= l - 1)
            t -= l - 1, l = 1;
          else
            l -= t, t = 0;
        else if (t >= m - r)
          t -= m - r, r = m;
        else
          r += t, t = 0;
      }
    } else {
      int tmp = l;
      for (int i = tmp + 1 - 1; i >= 2; i--) {
        if (ok2(0, i))
          l--, t--;
        else
          break;
        if (!t) break;
      }
      if (t) {
        tmp = r;
        for (int i = tmp; i < m; i++) {
          if (ok2(0, i))
            r++, t--;
          else
            break;
          if (!t) break;
        }
      }
    }
  } else if (d - u < r - l) {
    int t = (r - l) - (d - u), lim;
    if (u == d) {
      if (ok2(1, u)) {
        if (t >= u - 1)
          t -= u - 1, u = 1;
        else
          u -= t, t = 0;
        if (t >= n - d)
          t -= n - d, d = n;
        else
          d += t, t = 0;
      } else {
        if (u - 1 >= n - d)
          if (t >= u - 1)
            t -= u - 1, u = 1;
          else
            u -= t, t = 0;
        else if (t >= n - d)
          t -= n - d, d = n;
        else
          d += t, t = 0;
      }
    } else {
      int tmp = u;
      for (int i = tmp + 1 - 1; i >= 2; i--) {
        if (ok2(1, i))
          u--, t--;
        else
          break;
        if (!t) break;
      }
      if (t) {
        tmp = d;
        for (int i = tmp; i < n; i++) {
          if (ok2(1, i))
            d++, t--;
          else
            break;
          if (!t) break;
        }
      }
    }
  }
  if (ok()) {
    for (int i = u; i < d + 1; i++) {
      if (G[i][l] == '.') G[i][l] = '+';
      if (G[i][r] == '.') G[i][r] = '+';
    }
    for (int j = l; j < r + 1; j++) {
      if (G[u][j] == '.') G[u][j] = '+';
      if (G[d][j] == '.') G[d][j] = '+';
    }
    for (int i = 1; i < n + 1; i++) printf("%s\n", G[i] + 1);
  } else
    puts("-1");
}
