#include <bits/stdc++.h>
using namespace std;
int n, m, sum;
char a[2000][2001];
bool draw(int x, int y, int z) {
  int temp = 0;
  for (int i = z; i < z + x; i++)
    if (a[y][i] == 'w') temp++;
  for (int i = z; i < z + x; i++)
    if (a[y + x - 1][i] == 'w') temp++;
  for (int i = y + 1; i < y + x - 1; i++) {
    if (a[i][z] == 'w') temp++;
    if (a[i][z + x - 1] == 'w') temp++;
  }
  return temp >= sum;
}
void draw2(int x, int y, int z) {
  for (int i = z; i < z + x; i++)
    if (a[y][i] != 'w') a[y][i] = '+';
  for (int i = z; i < z + x; i++)
    if (a[y + x - 1][i] != 'w') a[y + x - 1][i] = '+';
  for (int i = y + 1; i < y + x - 1; i++) {
    if (a[i][z] != 'w') a[i][z] = '+';
    if (a[i][z + x - 1] != 'w') a[i][z + x - 1] = '+';
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", a[i]);
  int mx = 0, my = 0, m2x = 4000, m2y = 4000;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == 'w') {
        my = max(my, i), mx = max(mx, j);
        m2y = min(m2y, i), m2x = min(m2x, j);
        sum++;
      }
  int dx = mx - m2x + 1, dy = my - m2y + 1;
  bool flag = 1;
  if (dx == dy && draw(dx, m2x, m2y))
    flag = 0, draw2(dx, m2y, m2x);
  else if (dx > dy) {
    int m1 = min(m2y, my - dx + 1), m2 = m2y + my - dx + 1 - m1;
    for (int i = max(m1, 0); i <= m2; i++) {
      if (i + dx - 1 < n && draw(dx, i, m2x)) {
        draw2(dx, i, m2x);
        flag = 0;
        break;
      }
    }
  } else {
    int m1 = min(m2x, mx - dy + 1), m2 = m2x + mx - dy + 1 - m1;
    for (int i = max(m1, 0); i <= m2; i++) {
      if (i + dy - 1 < m && draw(dy, m2y, i)) {
        draw2(dy, m2y, i);
        flag = 0;
        break;
      }
    }
  }
  if (flag)
    printf("%d\n", -1);
  else
    for (int i = 0; i < n; i++, putchar(10))
      for (int j = 0; j < m; j++) printf("%c", a[i][j]);
  return 0;
}
