#include <bits/stdc++.h>
using namespace std;
int n, m;
int t[3000][3000];
int suma[3000][3000];
int calcula(int i1, int j1, int i2, int j2) {
  if (j2 < j1 or i2 < i1) return 0;
  return suma[i2][j2] - suma[i1 - 1][j2] - suma[i2][j1 - 1] +
         suma[i1 - 1][j1 - 1];
}
int sol = 1000000000;
int isol, jsol;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  int total = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      if (c != '.') {
        t[i][j] = 1;
        total++;
      }
      suma[i][j] =
          suma[i - 1][j] + suma[i][j - 1] - suma[i - 1][j - 1] + t[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (suma[i - 1][m] == 0 and suma[n][j - 1] == 0) {
        int inf = -1;
        int sup = min(n - i, m - j) + 1;
        while (inf + 1 < sup) {
          int med = (inf + sup) / 2;
          if (suma[i + med][j + med] == total)
            sup = med;
          else
            inf = med;
        }
        if (sup < min(n - 1, m - j) + 1 and sup < sol) {
          bool ok;
          if (sup == 0)
            ok = total == t[i][j];
          else if (sup == 1)
            ok = total == t[i][j] + t[i + 1][j] + t[i][j + 1] + t[i + 1][j + 1];
          else
            ok = calcula(i + sup, j, i + sup, j + sup) +
                     calcula(i, j + sup, i + sup - 1, j + sup) +
                     calcula(i, j, i + sup - 1, j) +
                     calcula(i, j + 1, i, j + sup - 1) ==
                 total;
          if (ok) {
            sol = sup;
            isol = i;
            jsol = j;
          }
        }
      }
    }
  }
  if (sol == 1000000000)
    cout << -1 << endl;
  else {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (t[i][j])
          cout << "w";
        else if ((isol == i and j >= jsol and j <= jsol + sol) or
                 (isol + sol == i and j >= jsol and j <= jsol + sol) or
                 (jsol == j and i >= isol and i <= isol + sol) or
                 (jsol + sol == j and i >= isol and i <= isol + sol))
          cout << "+";
        else
          cout << ".";
      }
      cout << endl;
    }
  }
}
