#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int MAXN = 2010;
char mat[MAXN][MAXN];
int row[MAXN][MAXN], col[MAXN][MAXN];
int n, m;
int up, down, Left, Right;
bool inBorder(int i, int j) {
  if ((i == up || i == down) && j >= Left && j <= Right) return true;
  if ((j == Left || j == Right) && i >= up && i <= down) return true;
  return false;
}
bool check() {
  for (int i = 1; i <= (n); ++i)
    for (int j = 1; j <= (m); ++j)
      if (mat[i][j] == 'w') {
        if (!inBorder(i, j)) return false;
      }
  return true;
}
bool solve() {
  int h = down - up, w = Right - Left;
  int add = abs(h - w);
  if (h > w) {
    if (Left == Right &&
        (down - up < 2 ||
         down - up >= 2 && col[down - 1][Left] - col[up][Left])) {
      if (Left - add >= 1) {
        Left -= add;
      } else if (Right + add <= m) {
        Right += add;
      } else
        return false;
      return true;
    }
    if (down - up >= 2 && col[down - 1][Left] - col[up][Left] == 0) {
      while (Left > 1 && add) --Left, --add;
    }
    if (down - up >= 2 && col[down - 1][Right] - col[up][Right] == 0) {
      while (Right < m && add) ++Right, --add;
    }
    return !add;
  } else {
    if (up == down &&
        (Right - Left < 2 ||
         Right - Left >= 2 && row[up][Right - 1] - row[up][Left])) {
      if (up - add >= 1) {
        up -= add;
      } else if (down + add <= n) {
        down += add;
      } else
        return false;
      return true;
    }
    if (Right - Left >= 2 && row[up][Right - 1] - row[up][Left] == 0) {
      while (up > 1 && add) --up, --add;
    }
    if (Right - Left >= 2 && row[down][Right - 1] - row[down][Left] == 0) {
      while (down < n && add) ++down, --add;
    }
    return !add;
  }
  return true;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    up = down = Left = Right = -1;
    memset(row, (0), sizeof(row));
    memset(col, (0), sizeof(col));
    for (int i = 1; i <= (n); ++i) {
      scanf("%s", mat[i] + 1);
      for (int j = 1; j <= (m); ++j) {
        row[i][j] = row[i][j - 1] + (mat[i][j] == 'w');
        col[i][j] = col[i - 1][j] + (mat[i][j] == 'w');
        if (mat[i][j] == 'w') {
          if (up == -1) {
            up = down = i;
            Left = Right = j;
          } else {
            up = min(up, (i));
            down = max(down, (i));
            Left = min(Left, (j));
            Right = max(Right, (j));
          }
        }
      }
    }
    if (!solve()) {
      puts("-1");
    } else {
      if (!check()) {
        puts("-1");
        continue;
      }
      for (int i = Left; i <= Right; ++i) {
        if (mat[up][i] != 'w') mat[up][i] = '+';
        if (mat[down][i] != 'w') mat[down][i] = '+';
      }
      for (int i = up; i <= down; ++i) {
        if (mat[i][Left] != 'w') mat[i][Left] = '+';
        if (mat[i][Right] != 'w') mat[i][Right] = '+';
      }
      for (int i = 1; i <= (n); ++i) puts(mat[i] + 1);
      puts("");
    }
  }
  return 0;
}
