#include <bits/stdc++.h>
using namespace std;
char str[2005][2005];
int n, m;
int l, r, u, d;
int len;
int sum;
void init() {
  int i, j;
  for (i = 0; i < n; i++) scanf(" %s", str[i]);
  l = u = 2005;
  r = d = -1;
  sum = 0;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      if (str[i][j] == 'w') {
        l = min(l, j);
        u = min(u, i);
        r = max(r, j);
        d = max(d, i);
        sum++;
      }
    }
}
bool work1() {
  int i, j, k;
  int minid = 2005, maxid = -1;
  for (i = 0; i < n; i++) {
    if (str[i][l] == 'w' || str[i][r] == 'w') {
      maxid = max(maxid, i);
      minid = min(minid, i);
    }
  }
  u = max(0, maxid - len + 1);
  for (i = 0; i < n; i++)
    for (j = l + 1; j < r; j++)
      if (str[i][j] == 'w') {
        if (i == 1 && j == 3) {
          int tmp = 1;
        }
        u = i;
        break;
      }
  if (u > minid && u < maxid) return false;
  if (u <= minid) {
    if (minid == maxid && u == minid) {
      u = maxid - len + 1;
      d = maxid;
      if (u >= 0 && d < n)
        return true;
      else {
        u = minid;
        d = u + len - 1;
        if (u >= 0 && d < n) return true;
        return false;
      }
    }
    d = u + len - 1;
    return d < n;
  }
  if (u >= maxid) {
    d = u;
    u = d - len + 1;
    return u >= 0;
  }
}
bool work2() {
  int i, j, k;
  int minid = 2005, maxid = -1;
  for (j = 0; j < m; j++) {
    if (str[u][j] == 'w' || str[d][j] == 'w') {
      maxid = max(maxid, j);
      minid = min(minid, j);
    }
  }
  l = max(0, maxid - len + 1);
  for (j = 0; j < m; j++)
    for (i = u + 1; i < d; i++)
      if (str[i][j] == 'w') {
        l = j;
        break;
      }
  if (l > minid && l < maxid) return false;
  if (l <= minid) {
    if (minid == maxid && minid == l) {
      l = maxid - len + 1;
      r = maxid;
      if (l >= 0 && r < m)
        return true;
      else {
        l = minid;
        r = l + len - 1;
        if (l >= 0 && r < m) return true;
        return false;
      }
    }
    r = l + len - 1;
    return r < m;
  }
  if (l >= maxid) {
    r = l;
    l = r - len + 1;
    return l >= 0;
  }
}
void print() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((i == u || i == d) && j >= l && j <= r) {
        if (str[i][j] == 'w')
          printf("w");
        else
          printf("+");
      } else if ((j == l || j == r) && i > u && i < d) {
        if (str[i][j] == 'w')
          printf("w");
        else
          printf("+");
      } else
        printf(".");
    }
    printf("\n");
  }
}
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    init();
    int tmpsum = 0;
    if (r - l >= d - u) {
      len = r - l + 1;
      if (work1()) {
        for (int i = u; i <= d; i++)
          for (int j = l; j <= r; j++)
            if (i == u || i == d || j == l || j == r)
              if (str[i][j] == 'w') tmpsum++;
        if (tmpsum == sum)
          print();
        else
          puts("-1");
      } else
        puts("-1");
    } else {
      len = d - u + 1;
      if (work2()) {
        for (int i = u; i <= d; i++)
          for (int j = l; j <= r; j++)
            if (i == u || i == d || j == l || j == r)
              if (str[i][j] == 'w') tmpsum++;
        if (tmpsum == sum)
          print();
        else
          puts("-1");
      } else
        puts("-1");
    }
  }
  return 0;
}
