#include <bits/stdc++.h>
using namespace std;
const long long MAX = 2500000000;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-9;
const double PII = 2 * asin(1.0);
const long long mod = 1e9 + 7;
int double_cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
int n, m;
string mapa[2010];
int vetor[2010][2010];
int tot, menor, xf, yf, af, bf;
int comp(int x, int y, int a, int b) {
  int A = vetor[a][b];
  int B = (y - 1 >= 0 ? vetor[a][y - 1] : 0);
  int C = (x - 1 >= 0 ? vetor[x - 1][b] : 0);
  int D = (x - 1 >= 0 && y - 1 >= 0 ? vetor[x - 1][y - 1] : 0);
  return A - B - C + D;
}
bool busca(int x, int y, int& a, int& b) {
  int lo = x - 1, hi = n;
  while (hi - lo > 1) {
    int mid = (hi + lo) / 2;
    if (comp(x, y, mid, m - 1) >= tot)
      hi = mid;
    else
      lo = mid;
  }
  if (hi == n) return false;
  a = hi;
  lo = y - 1, hi = m;
  while (hi - lo > 1) {
    int mid = (hi + lo) / 2;
    if (comp(x, y, a, mid) >= tot)
      hi = mid;
    else
      lo = mid;
  }
  if (hi == m) return false;
  b = hi;
  return true;
}
void build(int x, int y, int a, int b) {
  int v = a - x;
  int h = b - y;
  if (v > h) {
    if ((v - h) > (m - b - 1)) return;
    b = y + v;
  } else if (h > v) {
    if ((h - v) > (n - a - 1)) return;
    a = x + h;
  }
  int cima, baixo, esq, dir;
  cima = comp(x, y, x, b);
  baixo = comp(a, y, a, b);
  esq = comp(x, y, a, y);
  dir = comp(x, b, a, b);
  if (mapa[x][y] == 'w') cima--;
  if (mapa[x][b] == 'w') dir--;
  if (mapa[a][y] == 'w') esq--;
  if (mapa[a][b] == 'w') baixo--;
  if (cima + baixo + esq + dir == tot) {
    if (a - x < menor) {
      af = a;
      bf = b;
      xf = x;
      yf = y;
      menor = a - x;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) cin >> mapa[i];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (mapa[i][j] == 'w') {
        tot++;
        vetor[i][j] = 1;
      }
    }
  }
  if (tot == 1) {
    for (int i = 0; i < n; ++i) cout << mapa[i] << endl;
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j < m; ++j) vetor[i][j] += vetor[i][j - 1];
  }
  for (int i = 0; i < m; ++i) {
    for (int j = 1; j < n; ++j) vetor[j][i] += vetor[j - 1][i];
  }
  menor = inf;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int a, b;
      if (busca(i, j, a, b)) build(i, j, a, b);
    }
  }
  if (menor == inf)
    printf("%d\n", -1);
  else {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (i == xf || i == af) {
          if (j >= yf && j <= bf)
            if (mapa[i][j] != 'w') mapa[i][j] = '+';
        }
        if (j == yf || j == bf) {
          if (i >= xf && i <= af)
            if (mapa[i][j] != 'w') mapa[i][j] = '+';
        }
      }
    }
    for (int i = 0; i < n; ++i) cout << mapa[i] << endl;
  }
}
