#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
string s[2222];
int sum[2222][2222];
int n, m;
int get_sum(int i, int j, int ii, int jj) {
  if (i > ii || j > jj) return 0;
  return sum[ii][jj] - sum[i - 1][jj] - sum[ii][j - 1] + sum[i - 1][j - 1];
}
int sumRamka(int i, int j, int ii, int jj) {
  return get_sum(i, j, ii, jj) - get_sum(i + 1, j + 1, ii - 1, jj - 1);
}
void wrAns(int i, int j, int D) {
  int ii = i + D - 1, jj = j + D - 1;
  for (int x = i; x <= ii; x++) {
    if (s[x][j] == '.') s[x][j] = '+';
    if (s[x][jj] == '.') s[x][jj] = '+';
  }
  for (int x = j; x <= jj; x++) {
    if (s[i][x] == '.') s[i][x] = '+';
    if (s[ii][x] == '.') s[ii][x] = '+';
  }
  for (int i = 0; i < n; i++) cout << s[i] << '\n';
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> s[i];
  int minI = INF, minJ = INF, maxI = -INF, maxJ = -INF;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (s[i][j] == 'w') {
        minI = min(minI, i);
        maxI = max(maxI, i);
        minJ = min(minJ, j);
        maxJ = max(maxJ, j);
      }
  int D = max(maxI - minI + 1, maxJ - minJ + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] +
                  (s[i - 1][j - 1] == 'w');
  for (int i = 1; i <= n - D + 1; i++)
    for (int j = 1; j <= m - D + 1; j++) {
      if (sum[n][m] - sumRamka(i, j, i + D - 1, j + D - 1) == 0) {
        wrAns(i - 1, j - 1, D);
      }
    }
  cout << -1;
  return 0;
}
