#include <bits/stdc++.h>
using namespace std;
char a[2005][2005], ans[2005][2005];
int row[2005][2005], col[2005][2005];
int main() {
  ios::sync_with_stdio(false);
  ;
  cin.tie(0);
  ;
  int tot = 0, got = 0, i, j, n, m, ans_x1, ans_x2, ans_y1, ans_y2, x, y,
      cnt = 0, right_most = 0, bottom_most = 0;
  string s;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> s;
    s = " " + s;
    for (j = 1; j <= m; j++) {
      a[i][j] = s[j];
      tot += (a[i][j] == 'w');
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      row[i][j] = row[i][j - 1];
      row[i][j] += (a[i][j] == 'w');
    }
  }
  for (j = 1; j <= m; j++) {
    for (i = 1; i <= n; i++) {
      col[j][i] = col[j][i - 1];
      col[j][i] += (a[i][j] == 'w');
    }
  }
  for (j = m; j >= 1; j--) {
    cnt = 0;
    for (i = 1; i <= n; i++) cnt += (a[i][j] == 'w');
    if (cnt) {
      right_most = j;
      break;
    }
  }
  for (i = n; i >= 1; i--) {
    cnt = 0;
    for (j = 1; j <= m; j++) cnt += (a[i][j] == 'w');
    if (cnt) {
      bottom_most = i;
      break;
    }
  }
  int res = 100000000;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      x = right_most - j;
      y = bottom_most - i;
      if (x < 0 || y < 0) continue;
      x = max(x, y);
      if (i + x > n || j + x > m) continue;
      got = 0;
      if (j + x >= j - 1) {
        got += row[i][j + x] - row[i][j - 1];
        if (i + x != i) got += row[i + x][j + x] - row[i + x][j - 1];
      }
      if (i + x - 1 >= i) {
        got += col[j][i + x - 1] - col[j][i];
        if (j + x != j) got += col[j + x][i + x - 1] - col[j + x][i];
      }
      if (got == tot) {
        if (res > (x + 1) * (x + 1)) {
          res = (x + 1) * (x + 1);
          ans_x1 = i;
          ans_y1 = j;
          ans_x2 = i + x;
          ans_y2 = j + x;
        }
      }
    }
  }
  if (res == 100000000) {
    cout << "-1";
    return 0;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) ans[i][j] = a[i][j];
  }
  for (j = ans_y1; j <= ans_y2; j++) {
    if (ans[ans_x1][j] == '.') ans[ans_x1][j] = '+';
    if (ans[ans_x2][j] == '.') ans[ans_x2][j] = '+';
  }
  for (i = ans_x1; i <= ans_x2; i++) {
    if (ans[i][ans_y1] == '.') ans[i][ans_y1] = '+';
    if (ans[i][ans_y2] == '.') ans[i][ans_y2] = '+';
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) cout << ans[i][j];
    cout << "\n";
  }
  return 0;
}
