#include <bits/stdc++.h>
using namespace std;
char g[2010][2010];
int n, m;
void color(int x, int y) {
  if (g[x][y] != 'w') g[x][y] = '+';
}
void print(int l, int r, int t, int b) {
  for (int i = l; i <= r; i++) color(t, i), color(b, i);
  for (int i = t; i <= b; i++) color(i, l), color(i, r);
  for (int i = 1; i <= n; i++) printf("%s\n", g[i] + 1);
}
int sum(int l, int r, int t, int b) {
  int ret = 0;
  for (int i = l; i <= r; i++) ret += (g[t][i] == 'w') + (g[b][i] == 'w');
  for (int i = t + 1; i < b; i++) ret += (g[i][l] == 'w') + (g[i][r] == 'w');
  return ret;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", g[i] + 1);
  int l = 3000, t = 3000, r = 0, b = 0, wcnt = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (g[i][j] == 'w') {
        wcnt++;
        l = min(l, j);
        r = max(r, j);
        t = min(t, i);
        b = max(b, i);
      }
    }
  if (b - t == 0 && r - l == 0) {
    print(l, r, t, b);
    return 0;
  }
  if (b - t > r - l) {
    int d = b - t;
    for (int i = 1; i <= m - d; i++)
      if (sum(i, i + d, t, b) == wcnt) {
        print(i, i + d, t, b);
        return 0;
      }
  } else {
    int d = r - l;
    for (int i = 1; i <= n - d; i++)
      if (sum(l, r, i, i + d) == wcnt) {
        print(l, r, i, i + d);
        return 0;
      }
  }
  printf("-1");
  return 0;
}
