#include <bits/stdc++.h>
using namespace std;
const int MAXINT = 1111 * 1111 * 1111;
const long long MAXLINT = MAXINT * 1ll * MAXINT;
const long double EPS = 1e-10;
int n, m;
char a[2005][2005];
int sum[2005][2005];
int Sum(int x, int y) {
  if (x < 0 || y < 0) return 0;
  if (x >= n || y >= m) return 0;
  return sum[x][y];
}
int Sum(int x1, int y1, int x2, int y2) {
  if (x1 > x2 || y1 > y2) return 0;
  return Sum(x2, y2) - Sum(x2, y1 - 1) - Sum(x1 - 1, y2) + Sum(x1 - 1, y1 - 1);
}
bool Ok(int x1, int y1, int x2, int y2) {
  if (x2 >= n || y2 >= m) return false;
  if (x1 < 0 || y1 < 0) return false;
  if (Sum(x1 + 1, y1 + 1, x2 - 1, y2 - 1)) return false;
  if (Sum(0, 0, n - 1, y1 - 1) || Sum(0, 0, x1 - 1, m - 1) ||
      Sum(0, y2 + 1, n - 1, m - 1) || Sum(x2 + 1, 0, n - 1, m - 1))
    return false;
  return true;
}
void paint(int x1, int y1, int x2, int y2, int dx, int dy) {
  int x = x1, y = y1;
  while (x >= min(x1, x2) && y >= min(y1, y2) && x <= max(x1, x2) &&
         y <= max(y1, y2)) {
    if (a[x][y] == '.') a[x][y] = '+';
    x += dx;
    y += dy;
  }
}
int main() {
  scanf("%d%d\n", &n, &m);
  for (int i = 0; i < n; i++) gets(a[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      sum[i][j] = Sum(i - 1, j) + Sum(i, j - 1) - Sum(i - 1, j - 1) +
                  ((a[i][j] == 'w') ? 1 : 0);
  int d = 10000, x, y;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      int l = -1, r = min(n - i, m - j);
      while (r - l > 1) {
        int k = (l + r) >> 1;
        if (Sum(i + 1, j + 1, i + k - 1, j + k - 1)) {
          r = k;
          continue;
        }
        if (Ok(i, j, i + k, j + k))
          r = k;
        else
          l = k;
      }
      if (r >= min(n - i, m - j)) continue;
      if (d > r && Ok(i, j, i + r, j + r)) {
        d = r;
        x = i;
        y = j;
      }
    }
  if (d == 10000) {
    cout << -1;
    return 0;
  }
  paint(x, y, x + d, y + d, 1, 0);
  paint(x, y, x + d, y + d, 0, 1);
  paint(x + d, y + d, x, y, -1, 0);
  paint(x + d, y + d, x, y, 0, -1);
  for (int i = 0; i < n; i++) puts(a[i]);
  return 0;
}
