#include <bits/stdc++.h>
using namespace std;
int n, m, r[2010][2010], c[2010][2010];
char s[2010][2010];
int Cal(int x, int y, int l) {
  if (l == 1) return s[x][y] == 'w';
  int ret = 0;
  ret += r[x][y + l - 2] - r[x][y - 1];
  ret += c[y + l - 1][x + l - 2] - c[y + l - 1][x - 1];
  ret += r[x + l - 1][y + l - 1] - r[x + l - 1][y];
  ret += c[y][x + l - 1] - c[y][x];
  return ret;
}
void Out(int x, int y, int l) {
  for (int i = y; i <= y + l - 2; i++)
    if (s[x][i] == '.') s[x][i] = '+';
  for (int i = x; i <= x + l - 2; i++)
    if (s[i][y + l - 1] == '.') s[i][y + l - 1] = '+';
  for (int i = y + 1; i <= y + l - 1; i++)
    if (s[x + l - 1][i] == '.') s[x + l - 1][i] = '+';
  for (int i = x + 1; i <= x + l - 1; i++)
    if (s[i][y] == '.') s[i][y] = '+';
  for (int i = 1; i <= n; i++, cout << endl)
    for (int j = 1; j <= m; j++) cout << s[i][j];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  int cnt = 0, x = -1, y = -1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i][j] == 'w') {
        cnt++;
        r[i][j] = r[i][j - 1] + 1;
        c[j][i] = c[j][i - 1] + 1;
        x = max(x, i);
        y = max(y, j);
      } else {
        r[i][j] = r[i][j - 1];
        c[j][i] = c[j][i - 1];
      }
  int ret = n + 1, xx = -1, yy = -1;
  for (int i = 1; i <= x; i++)
    for (int j = 1; j <= y; j++) {
      int l = max(x - i + 1, y - j + 1);
      if (i + l - 1 > n || j + l - 1 > m) continue;
      int t = Cal(i, j, l);
      if (t != cnt) continue;
      if (ret > l) ret = l, xx = i, yy = j;
    }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j + x - 1 <= n && i + j - 1 <= m; j++) {
      int t = Cal(x, i, j);
      if (t != cnt) continue;
      if (ret > j) ret = j, y = i;
    }
  }
  if (ret == n + 1)
    cout << -1 << endl;
  else {
    Out(xx, yy, ret);
  }
  return 0;
}
