#include <bits/stdc++.h>
using namespace std;
const int maxn = 2020, INF = 1 << 29;
int n, m, minx = maxn, miny = maxn, maxx, maxy, wcnt, minsl = INF, bestx, besty;
int arr[maxn][maxn], pref[maxn][maxn];
int getPref(int sx, int sy, int lx, int ly) {
  if (sx > lx || sy > ly) return 0;
  sx--, sy--;
  return pref[lx][ly] - pref[sx][ly] - pref[lx][sy] + pref[sx][sy];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  char c;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> c;
      arr[i][j] = (c == '.' ? 0 : 1);
      if (arr[i][j]) {
        minx = min(minx, i);
        miny = min(miny, j);
        maxx = max(maxx, i);
        maxy = max(maxy, j);
      }
    }
  }
  pref[1][1] = arr[1][1];
  for (int i = 2; i <= n; i++) {
    pref[i][1] = pref[i - 1][1] + arr[i][1];
  }
  for (int i = 2; i <= m; i++) {
    pref[1][i] = pref[1][i - 1] + arr[1][i];
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 2; j <= m; j++) {
      pref[i][j] =
          arr[i][j] + pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1];
    }
  }
  wcnt = pref[n][m];
  for (int cx = 1; cx <= minx; cx++) {
    for (int cy = 1; cy <= miny; cy++) {
      int hi = max(maxx - cx, maxy - cy);
      if (cx + hi > n || cy + hi > m) continue;
      if (getPref(cx, cy, cx + hi, cy + hi) < wcnt) continue;
      if (hi >= minsl) continue;
      int tot = getPref(cx, cy, cx + hi, cy) +
                (hi > 0 ? getPref(cx, cy + hi, cx + hi, cy + hi) : 0);
      tot += (getPref(cx, cy + 1, cx, cy + hi - 1) +
              getPref(cx + hi, cy + 1, cx + hi, cy + hi - 1));
      if (tot < wcnt) continue;
      minsl = hi, bestx = cx, besty = cy;
    }
  }
  if (minsl == INF) {
    cout << "-1\n";
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (arr[i][j]) {
        cout << 'w';
      } else {
        if ((i < bestx || j < besty || i > bestx + minsl ||
             j > besty + minsl) ||
            (i > bestx && i < bestx + minsl && j > besty &&
             j < besty + minsl)) {
          cout << '.';
        } else {
          cout << '+';
        }
      }
    }
    cout << '\n';
  }
  return 0;
}
