#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1 << 11;
char board[MAXN][MAXN];
int sum[MAXN][MAXN];
int main() {
  int n, m;
  while (cin >> n >> m) {
    memset(sum, 0, sizeof(sum));
    for (int i = 0; i < n; i++) cin >> board[i];
    int r1 = INT_MAX, r2 = INT_MIN, c1 = INT_MAX, c2 = INT_MIN;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (board[i][j] == 'w') {
          r1 = min(r1, i);
          r2 = max(r2, i);
          c1 = min(c1, j);
          c2 = max(c2, j);
        }
        sum[i + 1][j + 1] =
            sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + (board[i][j] == 'w');
      }
    }
    int len = max(r2 - r1, c2 - c1);
    for (int i = 0; i + len < n; i++) {
      for (int j = 0; j + len < m; j++) {
        if (sum[n][m] - sum[i + len + 1][j + len + 1]) continue;
        if (sum[i][j + len + 1] || sum[i + len + 1][j]) continue;
        if (len != 0 && (sum[i + len][j + len] - sum[i + 1][j + len] -
                         sum[i + len][j + 1] + sum[i + 1][j + 1]))
          continue;
        for (int c = j; c <= j + len; c++) {
          if (board[i][c] == '.') board[i][c] = '+';
          if (board[i + len][c] == '.') board[i + len][c] = '+';
        }
        for (int r = i; r <= i + len; r++) {
          if (board[r][j] == '.') board[r][j] = '+';
          if (board[r][j + len] == '.') board[r][j + len] = '+';
        }
        for (int r = 0; r < n; r++) {
          cout << board[r] << endl;
        }
        goto EXIT;
      }
    }
    cout << -1 << endl;
  EXIT:;
  }
}
