#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[2020][2020];
int sr[2020][2020];
int sc[2020][2020];
void print_res(int i1, int j1, int i2, int j2) {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == '.' && (i == i1 || i == i2 || j == j1 || j == j2) &&
          (i1 <= i && i <= i2 && j1 <= j && j <= j2))
        a[i][j] = '+';
      printf("%c", a[i][j]);
    }
    printf("\n");
  }
}
int main() {
  scanf("%d%d", &n, &m);
  int ti = 1e9, bi = 0, lj = 1e9, rj = 0;
  int total = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", a[i] + 1);
    for (int j = 1; j <= m; j++) {
      sr[i][j] = sr[i][j - 1] + (a[i][j] == 'w');
      sc[i][j] = sc[i - 1][j] + (a[i][j] == 'w');
      if (a[i][j] == 'w') {
        total++;
        ti = min(ti, i);
        bi = max(bi, i);
        lj = min(lj, j);
        rj = max(rj, j);
      }
    }
  }
  if (total == 1) {
    print_res(-1, -1, -1, -1);
    return 0;
  }
  for (int sz = 2;; sz++) {
    bool donothing = 1;
    if (ti + sz - 1 <= n) {
      donothing = 0;
      int t = ti;
      for (int j = 1; j + sz - 1 <= m; j++) {
        if ((sr[t][j + sz - 1] - sr[t][j - 1]) +
                (sr[t + sz - 1][j + sz - 1] - sr[t + sz - 1][j - 1]) +
                (sc[t + sz - 2][j] - sc[t][j]) +
                (sc[t + sz - 2][j + sz - 1] - sc[t][j + sz - 1]) ==
            total) {
          print_res(t, j, t + sz - 1, j + sz - 1);
          return 0;
        }
      }
    }
    if (bi - sz + 1 >= 1) {
      donothing = 0;
      int t = bi - sz + 1;
      for (int j = 1; j + sz - 1 <= m; j++) {
        if ((sr[t][j + sz - 1] - sr[t][j - 1]) +
                (sr[t + sz - 1][j + sz - 1] - sr[t + sz - 1][j - 1]) +
                (sc[t + sz - 2][j] - sc[t][j]) +
                (sc[t + sz - 2][j + sz - 1] - sc[t][j + sz - 1]) ==
            total) {
          print_res(t, j, t + sz - 1, j + sz - 1);
          return 0;
        }
      }
    }
    if (lj + sz - 1 <= m) {
      donothing = 0;
      int j = lj;
      for (int t = 1; t + sz - 1 <= n; t++) {
        if ((sr[t][j + sz - 1] - sr[t][j - 1]) +
                (sr[t + sz - 1][j + sz - 1] - sr[t + sz - 1][j - 1]) +
                (sc[t + sz - 2][j] - sc[t][j]) +
                (sc[t + sz - 2][j + sz - 1] - sc[t][j + sz - 1]) ==
            total) {
          print_res(t, j, t + sz - 1, j + sz - 1);
          return 0;
        }
      }
    }
    if (rj - sz + 1 >= 1) {
      donothing = 0;
      int j = rj - sz + 1;
      for (int t = 1; t + sz - 1 <= n; t++) {
        if ((sr[t][j + sz - 1] - sr[t][j - 1]) +
                (sr[t + sz - 1][j + sz - 1] - sr[t + sz - 1][j - 1]) +
                (sc[t + sz - 2][j] - sc[t][j]) +
                (sc[t + sz - 2][j + sz - 1] - sc[t][j + sz - 1]) ==
            total) {
          print_res(t, j, t + sz - 1, j + sz - 1);
          return 0;
        }
      }
    }
    if (donothing) break;
  }
  printf("-1");
  return 0;
}
