#include <bits/stdc++.h>
using namespace std;
char a[3000][3000];
int dr[3000][3000];
int dd[3000][3000];
int lr[3000][3000];
int ld[3000][3000];
int main() {
  int i, j, m, n, x1, y1, x2, y2, tot, b1, best, bx, by, tmp1, tmp2, x, y, len,
      cnt, minx, miny;
  scanf("%d%d", &m, &n);
  for (i = 0; i < m; i++) scanf("%s", a[i]);
  cnt = 0;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      if (a[i][j] == 'w') cnt++;
  memset(dr, 0, sizeof(dr));
  for (i = 0; i < m; i++)
    for (j = n - 1; j >= 0; j--) {
      dr[i][j] = dr[i][j + 1];
      if (a[i][j] == 'w') dr[i][j]++;
    }
  memset(dd, 0, sizeof(dd));
  for (i = m - 1; i >= 0; i--)
    for (j = 0; j < n; j++) {
      dd[i][j] = dd[i + 1][j];
      if (a[i][j] == 'w') dd[i][j]++;
    }
  memset(lr, -1, sizeof(lr));
  for (i = 0; i < m; i++)
    for (j = n - 1; j >= 0; j--) {
      lr[i][j] = lr[i][j + 1];
      if ((a[i][j] == 'w') && (lr[i][j] == -1)) lr[i][j] = j;
    }
  memset(ld, -1, sizeof(ld));
  for (i = m - 1; i >= 0; i--)
    for (j = 0; j < n; j++) {
      ld[i][j] = ld[i + 1][j];
      if ((a[i][j] == 'w') && (ld[i][j] == -1)) ld[i][j] = i;
    }
  minx = 2000000000;
  miny = 2000000000;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      if (a[i][j] == 'w') {
        if (i < minx) minx = i;
        if (j < miny) miny = j;
      }
  b1 = 0;
  for (i = m - 1; i >= 0; i--) {
    for (j = n - 1; j >= 0; j--)
      if (a[i][j] == 'w') {
        x1 = i;
        y1 = j;
        b1 = 1;
        break;
      }
    if (b1 == 1) break;
  }
  b1 = 0;
  for (j = n - 1; j >= 0; j--) {
    for (i = m - 1; i >= 0; i--)
      if (a[i][j] == 'w') {
        x2 = i;
        y2 = j;
        b1 = 1;
        break;
      }
    if (b1 == 1) break;
  }
  best = 2000000000;
  for (i = 0; i <= minx; i++)
    for (j = 0; j <= miny; j++) {
      if (((x1 == i) || (y1 == j)) && ((x2 == i) || (y2 == j))) {
        tot = dr[i][j];
        tot += dd[i][j];
        if (a[i][j] == 'w') tot--;
        if (tot == cnt) {
          tmp1 = lr[i][j] - j + 1;
          tmp2 = ld[i][j] - i + 1;
          if (tmp1 > tmp2)
            len = tmp1;
          else
            len = tmp2;
          if ((i + len <= m) && (j + len <= n))
            if (len < best) {
              best = len;
              bx = i;
              by = j;
            }
        }
      } else {
        if ((x1 != i) && (y1 != j)) {
          len = x1 - i + 1;
          if (y1 - j + 1 > len) len = y1 - j + 1;
        } else {
          len = x2 - i + 1;
          if (y2 - j + 1 > len) len = y2 - j + 1;
        }
        if ((i + len <= m) && (j + len <= n)) {
          tot = dr[i][j] - dr[i][j + len];
          tot += (dd[i][j] - dd[i + len][j]);
          tot += (dr[i + len - 1][j] - dr[i + len - 1][j + len]);
          tot += (dd[i][j + len - 1] - dd[i + len][j + len - 1]);
          if (a[i][j] == 'w') tot--;
          if (a[i][j + len - 1] == 'w') tot--;
          if (a[i + len - 1][j] == 'w') tot--;
          if (a[i + len - 1][j + len - 1] == 'w') tot--;
          if (tot == cnt) {
            if (len < best) {
              best = len;
              bx = i;
              by = j;
            }
          }
        }
      }
    }
  if (best == 2000000000)
    printf("-1\n");
  else {
    for (i = bx; i < bx + best; i++) {
      if (a[i][by] == '.') a[i][by] = '+';
      if (a[i][by + best - 1] == '.') a[i][by + best - 1] = '+';
    }
    for (j = by; j < by + best; j++) {
      if (a[bx][j] == '.') a[bx][j] = '+';
      if (a[bx + best - 1][j] == '.') a[bx + best - 1][j] = '+';
    }
    for (i = 0; i < m; i++) {
      printf("%s\n", a[i]);
    }
  }
}
