#include <bits/stdc++.h>
using namespace std;
int m, n, count_w = 0;
string board[2010];
int count_ws(int x, int y, int sq) {
  if (sq == 1) {
    return board[y][x] == 'w';
  }
  int count = 0;
  for (int i = x; i < x + sq; i++) {
    if (board[y][i] == 'w') count++;
    if (board[y + sq - 1][i] == 'w') count++;
  }
  for (int i = y + 1; i + 1 < y + sq; i++) {
    if (board[i][x] == 'w') count++;
    if (board[i][x + sq - 1] == 'w') count++;
  }
  return count;
}
int main() {
  cin >> m >> n;
  int leastx = 2010, maxx = -1, leasty = 2010, maxy = -1;
  for (int i = 0; i < m; i++) {
    cin >> board[i];
    for (int j = 0; j < board[i].length(); j++) {
      if (board[i][j] == 'w') {
        leastx = min(leastx, j);
        maxx = max(maxx, j);
        leasty = min(leasty, i);
        maxy = max(maxy, i);
        count_w++;
      }
    }
  }
  int square = max(maxx - leastx + 1, maxy - leasty + 1);
  if (square > m || square > n) {
    cout << "-1";
  } else {
    int xmax = min(leastx, n - square);
    int ymax = min(leasty, m - square);
    int found = 0, x, y, x0, y0;
    for (x = max(0, xmax - square); !found && x <= xmax; x++) {
      for (y = max(0, ymax - square); !found && y <= ymax; y++) {
        if (count_ws(x, y, square) == count_w) {
          found = 1;
          x0 = x;
          y0 = y;
          break;
        }
      }
    }
    x = x0;
    y = y0;
    if (!found) {
      cout << "-1";
    } else {
      for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
          if (board[i][j] == 'w') {
            cout << "w";
          } else if (board[i][j] == '.') {
            if (i >= y && i <= y + square - 1 &&
                (j == x || j == x + square - 1)) {
              cout << "+";
            } else if (j >= x && j <= x + square - 1 &&
                       (i == y || i == y + square - 1)) {
              cout << "+";
            } else {
              cout << ".";
            }
          }
        }
        cout << "\n";
      }
    }
  }
  return 0;
}
