#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n, m;
char a[3000][3000];
int ghab[3000][3000];
int shab[3000][3000];
int all;
int X1 = -1, Y1 = -1, X2 = -1, Y2 = -1, X3 = -1, Y3 = -1;
int dX1 = -1, dY1 = -1, dX2 = -1, dY2 = -1;
int mind = INT_MAX;
int rangehab(int X1, int Y1, int X2, int Y2) {
  if (X1 == X2) {
    if (Y1 == 0)
      return ghab[X1][Y2];
    else
      return ghab[X1][Y2] - ghab[X1][Y1 - 1];
  } else {
    if (X1 == 0)
      return shab[X2][Y1];
    else
      return shab[X2][Y1] - shab[X1 - 1][Y1];
  }
}
void findanother(int x, int y) {
  int i, j;
  for (i = 0; i < n; i++) {
    if (i == x) continue;
    for (j = 0; j < m; j++) {
      if (j == y) continue;
      if (a[i][j] == 'w') {
        X2 = i, Y2 = j;
        break;
      }
    }
    if (X2 != -1) break;
  }
  X1 = x, Y1 = y;
}
void issquare(int X1, int Y1, int X2, int Y2) {
  int hab = 0;
  hab += rangehab(X1, Y1, X1, Y2 - 1);
  hab += rangehab(X1, Y2, X2 - 1, Y2);
  hab += rangehab(X1 + 1, Y1, X2, Y1);
  hab += rangehab(X2, Y1 + 1, X2, Y2);
  if (hab == all) {
    if (mind > X2 - X1) {
      mind = X2 - X1;
      dX1 = X1, dY1 = Y1, dX2 = X2, dY2 = Y2;
    }
  }
}
void findcase1(int x, int y) {
  int i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (abs(i - x) == abs(j - y)) {
        issquare(min(i, x), min(j, y), max(i, x), max(j, y));
      }
    }
  }
}
void findcase2(int X1, int Y1, int X2, int Y2) {
  int i, j;
  int d;
  d = X2 - X1;
  for (i = 0; i < n; i++) {
    if (i + d >= m) break;
    issquare(X1, i, X2, i + d);
  }
  d = Y2 - Y1;
  for (i = 0; i < m; i++) {
    if (i + d >= n) break;
    issquare(i, Y1, i + d, Y2);
  }
}
int main() {
  int i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", a[i]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j] == 'w') all++;
      if (a[i][j] == 'w' && X1 == -1) {
        X1 = i, Y1 = j;
      } else if (a[i][j] == 'w' && X3 == -1) {
        X3 = i, Y3 = j;
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (a[i][0] == 'w') ghab[i][0] = 1;
    for (j = 1; j < m; j++) {
      ghab[i][j] = ghab[i][j - 1];
      if (a[i][j] == 'w') ghab[i][j]++;
    }
  }
  for (i = 0; i < m; i++) {
    if (a[0][i] == 'w') shab[0][i] = 1;
    for (j = 1; j < n; j++) {
      shab[j][i] = shab[j - 1][i];
      if (a[j][i] == 'w') shab[j][i]++;
    }
  }
  findanother(X1, Y1);
  if (X3 != -1 && X2 == -1) findanother(X3, Y3);
  if (X2 == -1) {
    int minx = INT_MAX, miny = INT_MAX, maxx = INT_MIN, maxy = INT_MIN;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (a[i][j] == 'w') {
          if (make_pair(minx, miny) > make_pair(i, j)) {
            minx = i, miny = j;
          }
          if (make_pair(maxx, maxy) < make_pair(i, j)) {
            maxx = i, maxy = j;
          }
        }
      }
    }
    findcase2(minx, miny, maxx, maxy);
    if (miny == maxy) {
      int d = maxx - minx;
      if (miny + d < m) {
        mind = d;
        dX1 = minx;
        dY1 = miny;
        dX2 = maxx;
        dY2 = miny + d;
      } else if (miny - d >= 0) {
        mind = d;
        dX1 = minx;
        dY1 = miny - d;
        dX2 = maxx;
        dX2 = miny;
      }
    } else {
      int d = maxy - miny;
      if (minx + d < n) {
        mind = d;
        dX1 = minx;
        dY1 = miny;
        dX2 = maxx + d;
        dY2 = maxy;
      } else if (minx - d >= 0) {
        mind = d;
        dX1 = minx - d;
        dY1 = miny;
        dX2 = maxx;
        dX2 = maxy;
      }
    }
  } else {
    findcase1(min(X1, X2), min(Y1, Y2));
    findcase1(min(X1, X2), max(Y1, Y2));
    findcase1(max(X1, X2), min(Y1, Y2));
    findcase1(max(X1, X2), max(Y1, Y2));
    findcase2(min(X1, X2), min(Y1, Y2), max(X1, X2), max(Y1, Y2));
  }
  if (mind == INT_MAX)
    printf("-1");
  else {
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (a[i][j] == 'w')
          printf("w");
        else {
          if (i >= dX1 && i <= dX2 && j >= dY1 && j <= dY2 &&
              (i == dX1 || i == dX2 || j == dY1 || j == dY2))
            printf("+");
          else
            printf(".");
        }
      }
      printf("\n");
    }
  }
  return 0;
}
