#include <bits/stdc++.h>
using namespace std;
int sum[2000][2000];
int getSum(int y1, int x1, int y2, int x2) {
  if (y1 > y2 || x1 > x2) return 0;
  int res = sum[y2][x2];
  if (x1 > 0) res -= sum[y2][x1 - 1];
  if (y1 > 0) res -= sum[y1 - 1][x2];
  if (x1 > 0 && y1 > 0) res += sum[y1 - 1][x1 - 1];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int m;
  cin >> m;
  vector<string> f(n);
  {
    for (int i = 0; i < n; i++) cin >> f[i];
  };
  int minX = 2000;
  int minY = 2000;
  int maxX = -1;
  int maxY = -1;
  for (int i = 0; i < n - 1 + 1; ++i)
    for (int j = 0; j < m - 1 + 1; ++j)
      if (f[i][j] == 'w') {
        { minX = min(minX, j); };
        { maxX = max(maxX, j); };
        { minY = min(minY, i); };
        { maxY = max(maxY, i); };
      }
  int size = max(maxX - minX, maxY - minY) + 1;
  for (int i = 0; i < n - 1 + 1; ++i) {
    int accInRow = 0;
    for (int j = 0; j < m - 1 + 1; ++j) {
      if (f[i][j] == 'w') accInRow++;
      sum[i][j] = accInRow;
      if (i > 0) sum[i][j] += sum[i - 1][j];
    }
  }
  int total = sum[n - 1][m - 1];
  int x1 = maxX - size + 1;
  int y1 = maxY - size + 1;
  { x1 = max(x1, 0); };
  { y1 = max(y1, 0); };
  int x2 = m - size;
  int y2 = n - size;
  { x2 = min(x2, minX); };
  { y2 = min(y2, minY); };
  for (int y = y1; y < y2 + 1; ++y)
    for (int x = x1; x < x2 + 1; ++x) {
      if (getSum(y, x, y + size - 1, x + size - 1) == total)
        if (getSum(y + 1, x + 1, y + size - 2, x + size - 2) == 0) {
          for (int i = 0; i < size - 1 + 1; ++i) {
            if (f[y][x + i] == '.') f[y][x + i] = '+';
            if (f[y + size - 1][x + i] == '.') f[y + size - 1][x + i] = '+';
            if (f[y + i][x] == '.') f[y + i][x] = '+';
            if (f[y + i][x + size - 1] == '.') f[y + i][x + size - 1] = '+';
          }
          for (int i = 0; i < n - 1 + 1; ++i) cout << f[i] << '\n';
          return 0;
        }
    }
  cout << -1;
}
