#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
string a[2010], b[2010];
set<pair<int, int> > s;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  int cnt = 0;
  int minx = -1;
  int miny = -1;
  int maxx = -1;
  int maxy = -1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == 'w') {
        if (minx == -1) {
          minx = i;
          maxx = i;
          miny = j;
          maxy = j;
        }
        minx = min(minx, i);
        maxx = max(maxx, i);
        miny = min(miny, j);
        maxy = max(maxy, j);
        cnt++;
        s.insert(make_pair(i, j));
      }
  if (cnt == 0) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++)
        if (i + j)
          cout << a[i][j];
        else
          cout << "+";
      cout << "\n";
    }
  }
  if (cnt == 1) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) cout << a[i][j];
      cout << "\n";
    }
  }
  if (cnt > 1) {
    bool leftx = false;
    bool lefty = false;
    bool rightx = false;
    bool righty = false;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++)
        if (a[i][j] == 'w') {
          if (minx == i && (miny != j && maxy != j)) leftx = true;
          if (maxx == i && (miny != j && maxy != j)) rightx = true;
          if (miny == j && (minx != i && maxx != i)) lefty = true;
          if (maxy == j && (minx != i && maxx != i)) righty = true;
        }
    if (minx == maxx && leftx) {
      if (minx + (maxy - miny) < n)
        maxx = minx + (maxy - miny);
      else if (minx + (maxy - miny) >= 0)
        minx = maxx - (maxy - miny);
    } else if (miny == maxy && lefty) {
      if (miny + (maxx - minx) < m)
        maxy = miny + (maxx - minx);
      else if (miny + (maxx - minx) >= 0)
        miny = maxy - (maxx - minx);
    } else {
      if (maxx - minx > maxy - miny) {
        while (maxx - minx > maxy - miny && !righty && maxy < m - 1) maxy++;
        while (maxx - minx > maxy - miny && !lefty && miny > 0) miny--;
      }
      if (maxx - minx < maxy - miny) {
        while (maxx - minx < maxy - miny && !rightx && maxx < n - 1) maxx++;
        while (maxx - minx < maxy - miny && !leftx && minx > 0) minx--;
      }
    }
    if (maxx - minx == maxy - miny) {
      bool z = true;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if ((a[i][j] == 'w') &&
              !((i == minx || i == maxx) && (j >= miny && j <= maxy) ||
                (j == miny || j == maxy) && (i >= minx && i <= maxx)))
            z = false;
        }
      }
      if (!z)
        cout << "-1";
      else {
        for (int i = 0; i < n; i++) {
          for (int j = 0; j < m; j++) {
            if (a[i][j] == 'w')
              cout << a[i][j];
            else if ((i == minx || i == maxx) && (j >= miny && j <= maxy) ||
                     (j == miny || j == maxy) && (i >= minx && i <= maxx))
              cout << "+";
            else
              cout << ".";
          }
          cout << "\n";
        }
      }
    } else
      cout << "-1";
  }
  return 0;
}
