#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[2222 * 2222];
char mat[2222][2222];
int sum[2222][2222];
int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 1; i <= N; i++) scanf("%s", mat[i] + 1);
  int cnt = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (mat[i][j] == 'w') p[cnt++] = pair<int, int>(i, j);
      sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] +
                  (mat[i][j] == 'w');
    }
  }
  int st = 0, ed = min(N, M), mid, x, y;
  while (ed - st > 1) {
    mid = (st + ed) >> 1;
    int fl = 0;
    for (int i = mid; i <= N; i++) {
      for (int j = mid; j <= M; j++) {
        if (sum[i][j] - sum[i - mid][j] - sum[i][j - mid] +
                sum[i - mid][j - mid] ==
            cnt) {
          fl = 1;
          break;
        }
        if (fl) break;
      }
      if (fl) break;
    }
    if (fl)
      ed = mid;
    else
      st = mid;
  }
  int fl = 0;
  mid = ed;
  for (int i = mid; i <= N; i++) {
    for (int j = mid; j <= M; j++) {
      int s =
          sum[i][j] - sum[i - mid][j] - sum[i][j - mid] + sum[i - mid][j - mid];
      if (mid > 2) {
        s -= sum[i - 1][j - 1] - sum[i - mid + 1][j - 1] -
             sum[i - 1][j - mid + 1] + sum[i - mid + 1][j - mid + 1];
      }
      if (s == cnt) {
        fl = 1;
        x = i, y = j;
        break;
      }
    }
    if (fl) break;
  }
  if (!fl) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if ((i == x || i == x - mid + 1) && (j >= y - mid + 1 && j <= y)) {
        if (mat[i][j] == 'w')
          printf("w");
        else
          printf("+");
      } else if ((j == y || j == y - mid + 1) && (i >= x - mid + 1 && i <= x)) {
        if (mat[i][j] == 'w')
          printf("w");
        else
          printf("+");
      } else
        printf("%c", mat[i][j]);
    }
    puts("");
  }
  return 0;
}
