#include <bits/stdc++.h>
using namespace std;
char x[2000][2001];
bool solve(int mini, int minj, int maxi, int maxj) {
  bool ok = true;
  for (int i = mini + 1; i <= maxi - 1; ++i)
    for (int j = minj + 1; j <= maxj - 1; ++j) ok = ok && x[i][j] == '.';
  if (ok) {
    for (int i = mini; i <= maxi; ++i) {
      if (x[i][minj] != 'w') x[i][minj] = '+';
      if (x[i][maxj] != 'w') x[i][maxj] = '+';
    }
    for (int j = minj; j <= maxj; ++j) {
      if (x[mini][j] != 'w') x[mini][j] = '+';
      if (x[maxi][j] != 'w') x[maxi][j] = '+';
    }
  }
  return ok;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", x[i]);
  int mini = 2000, minj = 2000, maxi = 0, maxj = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (x[i][j] == 'w') {
        mini = min(mini, i);
        minj = min(minj, j);
        maxi = max(maxi, i);
        maxj = max(maxj, j);
      }
    }
  int h = maxi - mini + 1;
  int w = maxj - minj + 1;
  bool ok = false;
  if (w == h)
    ok = solve(mini, minj, maxi, maxj);
  else if (w > h) {
    int diff = w - h;
    if (maxi + diff < n) ok = solve(mini, minj, maxi + diff, maxj);
    if (!ok && mini - diff > -1) ok = solve(mini - diff, minj, maxi, maxj);
    if (!ok) {
      int e1 = n - (maxi + 1);
      int e2 = diff - e1;
      if (e1 < diff && mini - e2 > -1)
        ok = solve(mini - e2, minj, maxi + e1, maxj);
    }
  } else {
    int diff = h - w;
    if (maxj + diff < m) ok = solve(mini, minj, maxi, maxj + diff);
    if (!ok && minj - diff > -1) ok = solve(mini, minj - diff, maxi, maxj);
    if (!ok) {
      int e1 = m - (maxj + 1);
      int e2 = diff - e1;
      if (e1 < diff && minj - e2 > -1)
        ok = solve(mini, minj - e2, maxi, maxj + e1);
    }
  }
  if (!ok)
    printf("-1\n");
  else {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) printf("%c", x[i][j]);
      printf("\n");
    }
  }
  return 0;
}
