#include <bits/stdc++.h>
using namespace std;
char grid[2002][2002];
int main(void) {
  int R, C, row, col, w, cm, cM, rm, rM, aw, mm, MM, siz, prev, now;
  bool ok;
  scanf("%d%d", &R, &C);
  w = 0;
  cm = C, cM = 0, rm = R, rM = 0;
  for (row = 0; row < R; row++) {
    scanf("%s", grid[row]);
    for (col = 0; col < C; col++) {
      if (grid[row][col] == 'w') {
        ++w;
        if (row < rm) rm = row;
        if (row > rM) rM = row;
        if (col < cm) cm = col;
        if (col > cM) cM = col;
      }
    }
  }
  ok = false;
  if (rM - rm + 1 == cM - cm + 1) {
    aw = 0;
    for (row = rm; row <= rM; row++) {
      if (grid[row][cm] == 'w') ++aw;
      if (cm != cM && grid[row][cM] == 'w') ++aw;
    }
    for (col = cm + 1; col < cM; col++) {
      if (grid[rm][col] == 'w') ++aw;
      if (rm != rM && grid[rM][col] == 'w') ++aw;
    }
    if (aw == w) {
      ok = true;
      for (row = rm; row <= rM; row++) {
        if (grid[row][cm] == '.') grid[row][cm] = '+';
        if (grid[row][cM] == '.') grid[row][cM] = '+';
      }
      for (col = cm + 1; col < cM; col++) {
        if (grid[rm][col] == '.') grid[rm][col] = '+';
        if (grid[rM][col] == '.') grid[rM][col] = '+';
      }
      for (row = 0; row < R; row++) puts(grid[row]);
    }
  } else if (rM - rm + 1 > cM - cm + 1) {
    siz = rM - rm + 1;
    if (cM - siz + 1 < 0)
      mm = 0;
    else
      mm = cM - siz + 1;
    if (cm + siz - 1 >= C)
      MM = C - 1;
    else
      MM = cm + siz - 1;
    if (MM - mm + 1 >= siz) {
      aw = 0;
      for (col = mm; col < mm + siz - 1; col++) {
        if (grid[rm][col] == 'w') ++aw;
        if (grid[rM][col] == 'w') ++aw;
      }
      for (col = mm; col + siz - 1 <= MM; col++) {
        if (grid[rm][col] == 'w') --aw;
        if (grid[rM][col] == 'w') --aw;
        now = 0;
        for (row = rm; row <= rM; row++) {
          if (grid[row][col] == 'w') ++now;
          if (grid[row][col + siz - 1] == 'w') ++now;
        }
        if (aw + now == w) {
          ok = true;
          for (row = rm; row <= rM; row++) {
            if (grid[row][col] == '.') grid[row][col] = '+';
            if (grid[row][col + siz - 1] == '.') grid[row][col + siz - 1] = '+';
          }
          cM = col + siz - 1;
          for (col++; col < cM; col++) {
            if (grid[rm][col] == '.') grid[rm][col] = '+';
            if (grid[rM][col] == '.') grid[rM][col] = '+';
          }
          for (row = 0; row < R; row++) puts(grid[row]);
          break;
        }
        if (grid[rm][col + siz - 1] == 'w') ++aw;
        if (grid[rM][col + siz - 1] == 'w') ++aw;
      }
    }
  } else {
    siz = cM - cm + 1;
    if (rM - siz + 1 < 0)
      mm = 0;
    else
      mm = rM - siz + 1;
    if (rm + siz - 1 >= R)
      MM = R - 1;
    else
      MM = rm + siz - 1;
    if (MM - mm + 1 >= siz) {
      aw = 0;
      for (row = mm; row < mm + siz - 1; row++) {
        if (grid[row][cm] == 'w') ++aw;
        if (grid[row][cM] == 'w') ++aw;
      }
      for (row = mm; row + siz - 1 <= MM; row++) {
        if (grid[row][cm] == 'w') --aw;
        if (grid[row][cM] == 'w') --aw;
        now = 0;
        for (col = cm; col <= cM; col++) {
          if (grid[row][col] == 'w') ++now;
          if (grid[row + siz - 1][col] == 'w') ++now;
        }
        if (aw + now == w) {
          ok = true;
          for (col = cm; col <= cM; col++) {
            if (grid[row][col] == '.') grid[row][col] = '+';
            if (grid[row + siz - 1][col] == '.') grid[row + siz - 1][col] = '+';
          }
          rM = row + siz - 1;
          for (row++; row < rM; row++) {
            if (grid[row][cm] == '.') grid[row][cm] = '+';
            if (grid[row][cM] == '.') grid[row][cM] = '+';
          }
          for (row = 0; row < R; row++) puts(grid[row]);
          break;
        }
        if (grid[row + siz - 1][cm] == 'w') ++aw;
        if (grid[row + siz - 1][cM] == 'w') ++aw;
      }
    }
  }
  if (!ok) puts("-1");
  return 0;
}
