#include <bits/stdc++.h>
const int SIZE_N = 2000 + 10;
const int SIZE_M = SIZE_N;
int n, m;
char map[SIZE_N][SIZE_M];
int up = n + 1, dow = 0, le = m + 1, ri = 0;
int cntw = 0;
int ans;
int chk(int u, int d) {
  int cnt = 0;
  for (int i = le; i < ri; ++i) {
    if (map[u][i] == 'w') ++cnt;
    if (map[u + d - 1][i + 1] == 'w') ++cnt;
  }
  for (int i = u; i < u + d - 1; ++i) {
    if (map[i][ri] == 'w') ++cnt;
    if (map[i + 1][le] == 'w') ++cnt;
  }
  return cnt == cntw;
}
void print(int u, int d) {
  for (int i = le; i < ri; ++i) {
    if (map[u][i] != 'w') map[u][i] = '+';
    if (map[u + d - 1][i + 1] != 'w') map[u + d - 1][i + 1] = '+';
  }
  for (int i = u; i < u + d - 1; ++i) {
    if (map[i][ri] != 'w') map[i][ri] = '+';
    if (map[i + 1][le] != 'w') map[i + 1][le] = '+';
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) printf("%c", map[i][j]);
    puts("");
  }
}
int chk2(int u, int d) {
  int cnt = 0;
  for (int i = up; i < dow; ++i) {
    if (map[i][u] == 'w') ++cnt;
    if (map[i + 1][u + d - 1] == 'w') ++cnt;
  }
  for (int i = u; i < u + d - 1; ++i) {
    if (map[dow][i] == 'w') ++cnt;
    if (map[up][i + 1] == 'w') ++cnt;
  }
  return cnt == cntw;
}
void print2(int u, int d) {
  for (int i = up; i < dow; ++i) {
    if (map[i][u] != 'w') map[i][u] = '+';
    if (map[i + 1][u + d - 1] != 'w') map[i + 1][u + d - 1] = '+';
  }
  for (int i = u; i < u + d - 1; ++i) {
    if (map[dow][i] != 'w') map[dow][i] = '+';
    if (map[up][i + 1] != 'w') map[up][i + 1] = '+';
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) printf("%c", map[i][j]);
    puts("");
  }
}
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%s", map[i] + 1);
  up = n + 1, dow = 0, le = m + 1, ri = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (map[i][j] == 'w') {
        ++cntw;
        up = std::min(up, i);
        dow = std::max(dow, i);
        le = std::min(le, j);
        ri = std::max(ri, j);
      }
  if (cntw == 1) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) printf("%c", map[i][j]);
      puts("");
    }
    return 0;
  }
  ans = std::max(dow - up + 1, ri - le + 1);
  if (ans > n || ans > m)
    puts("-1");
  else if (ans == ri - le + 1) {
    for (int i = 1; i + ans - 1 <= n; ++i) {
      if (chk(i, ans) == 1) {
        print(i, ans);
        return 0;
      }
    }
    puts("-1");
  } else if (ans == dow - up + 1) {
    for (int i = 1; i + ans - 1 <= m; ++i) {
      if (chk2(i, ans) == 1) {
        print2(i, ans);
        return 0;
      }
    }
    puts("-1");
  }
  return 0;
}
