#include <bits/stdc++.h>
using namespace std;
int n, m;
int pnum = 0;
char M[2002][2002];
pair<int, int> td_p[4000001];
void draw(int startX, int startY, int sqrLen) {
  int x = startX;
  int y = startY;
  for (; y < startY + sqrLen - 1; y++)
    if (M[y][x] == '.') M[y][x] = '+';
  for (; x < sqrLen + startX - 1; x++)
    if (M[y][x] == '.') M[y][x] = '+';
  for (; y > startY; y--)
    if (M[y][x] == '.') M[y][x] = '+';
  for (; x > startX; x--)
    if (M[y][x] == '.') M[y][x] = '+';
}
bool check_w(int startX, int startY, int sqrLen) {
  int tmp = 0;
  int x = startX;
  int y = startY;
  for (; y < startY + sqrLen - 1; y++)
    if (M[y][x] == 'w') tmp++;
  for (; x < sqrLen + startX - 1; x++)
    if (M[y][x] == 'w') tmp++;
  for (; y > startY; y--)
    if (M[y][x] == 'w') tmp++;
  for (; x > startX; x--)
    if (M[y][x] == 'w') tmp++;
  if (tmp == pnum)
    return true;
  else
    return false;
}
void printM() {
  for (int i = 1; i <= n; i++) {
    printf("%s\n", M[i] + 1);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  int maxX = 0, minY = n, minX = m, maxY = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", M[i] + 1);
    for (int j = 1; j <= m; j++) {
      if (M[i][j] == 'w') {
        pnum++;
        maxX = max(maxX, j);
        minX = min(minX, j);
        maxY = max(maxY, i);
        minY = min(minY, i);
      }
    }
  }
  if (pnum == 0) {
    printf("-1\n");
    return 0;
  }
  if (pnum == 1) {
    printM();
    return 0;
  }
  int dx = abs(maxX - minX);
  int dy = abs(maxY - minY);
  int sqrLen = ((dx > dy) ? dx + 1 : dy + 1);
  if (sqrLen > m || sqrLen > n) {
    printf("-1\n");
    return 0;
  }
  if (dx > dy) {
    int startX = minX;
    int startY;
    int tmp = 0;
    bool det = false;
    for (startY = maxY - sqrLen; startY <= minY; startY++) {
      if (startY <= 0 || startY >= n) continue;
      det = check_w(startX, startY, sqrLen);
      if (det == true) break;
    }
    if (det == true) {
      draw(startX, startY, sqrLen);
      printM();
    } else {
      printf("-1\n");
      return 0;
    }
  } else {
    int startY = minY;
    int startX;
    int tmp = 0;
    bool det = false;
    for (startX = maxX - sqrLen; startX <= minX; startX++) {
      if (startX <= 0 || startX >= m) continue;
      det = check_w(startX, startY, sqrLen);
      if (det == true) break;
    }
    if (det == true) {
      draw(startX, startY, sqrLen);
      printM();
    } else {
      printf("-1\n");
      return 0;
    }
  }
  return 0;
}
