#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 2e3 + 5;
const int mod = 1e9 + 7;
char g[maxm][maxm];
int n, m;
inline bool judge(int x1, int y1, int x2, int y2) {
  for (int i = x1 + 1; i < x2; i++) {
    for (int j = y1 + 1; j < y2; j++) {
      if (g[i][j] == 'w') return 0;
    }
  }
  return 1;
}
inline void print(int x1, int y1, int x2, int y2) {
  for (int i = x1; i < x2 + 1; i++) {
    if (g[i][y1] == '.') g[i][y1] = '+';
    if (g[i][y2] == '.') g[i][y2] = '+';
  }
  for (int i = y1; i < y2 + 1; i++) {
    if (g[x1][i] == '.') g[x1][i] = '+';
    if (g[x2][i] == '.') g[x2][i] = '+';
  }
  for (int i = 1; i < n + 1; i++) puts(g[i] + 1);
}
inline void solve() {
  scanf("%d%d", &n, &m);
  int top = n, button = 1, left = m, right = 1;
  for (int i = 1; i < n + 1; i++) {
    scanf("%s", g[i] + 1);
    for (int j = 1; j < m + 1; j++) {
      if (g[i][j] == 'w') {
        top = min(top, i);
        button = max(button, i);
        left = min(left, j);
        right = max(right, j);
      }
    }
  }
  int tmph = button - top, tmpv = right - left;
  if (tmph == tmpv) {
    if (judge(top, left, button, right)) {
      print(top, left, button, right);
    } else
      puts("-1");
  } else {
    if (tmph > tmpv) {
      for (int i = max(1, right - tmph); i < m - tmph + 1; i++) {
        if (judge(top, i, button, i + tmph)) {
          print(top, i, button, i + tmph);
          return;
        }
      }
      puts("-1");
    } else {
      for (int i = max(1, button - tmpv); i < n - tmpv + 1; i++) {
        if (judge(i, left, i + tmpv, right)) {
          print(i, left, i + tmpv, right);
          return;
        }
      }
      puts("-1");
    }
  }
}
int main() {
  solve();
  return 0;
}
