#include <bits/stdc++.h>
using namespace std;
int n, m;
int L = 1e9, R = -1e9, U = 1e9, D = -1e9;
char G[2010][2010];
int vis[2010][2010];
set<int> row;
set<int> col;
int checkValid() {
  int W = R - L + 1, H = D - U + 1;
  if (W == H) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (G[i][j] == 'w')
          cout << G[i][j];
        else if (!vis[i][j])
          cout << '.';
        else
          cout << '+';
      }
      cout << endl;
    }
    return 1;
  }
  return 0;
}
void markRow(int rowID, int l, int r, int val) {
  for (int j = l; j <= r; j++) vis[rowID][j] = val;
}
void markCol(int colID, int u, int d, int val) {
  for (int i = u; i <= d; i++) vis[i][colID] = val;
}
int canExpandL() {
  for (int i = U + 1; i < D; i++)
    if (G[i][L] == 'w') return 0;
  return 1;
}
int canExpandR() {
  for (int i = U + 1; i < D; i++)
    if (G[i][R] == 'w') return 0;
  return 1;
}
int canExpandU() {
  for (int j = L + 1; j < R; j++)
    if (G[U][j] == 'w') return 0;
  return 1;
}
int canExpandD() {
  for (int j = L + 1; j < R; j++)
    if (G[D][j] == 'w') return 0;
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> G[i][j];
      if (G[i][j] == '.') continue;
      L = min(L, j);
      R = max(R, j);
      U = min(U, i);
      D = max(D, i);
    }
  }
  for (int j = L; j <= R; j++) {
    vis[U][j] = 1;
    vis[D][j] = 1;
  }
  for (int i = U; i <= D; i++) {
    vis[i][L] = 1;
    vis[i][R] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (G[i][j] == 'w' && !vis[i][j]) return cout << -1 << endl, 0;
    }
  }
  int W = R - L + 1, H = D - U + 1;
  if (checkValid()) return 0;
  if (W > H) {
    int need = W - H;
    if (canExpandU() || (U == D && U >= need)) {
      int can = min(need, U);
      markRow(U, L, R, 0);
      markCol(L, U - can, U, 1);
      markCol(R, U - can, U, 1);
      U -= can;
      markRow(U, L, R, 1);
    }
    if (checkValid()) return 0;
    W = R - L + 1, H = D - U + 1;
    need = W - H;
    if (canExpandD() || U == D) {
      int can = min(need, n - D - 1);
      markRow(D, L, R, 0);
      markCol(L, D, D + can, 1);
      markCol(R, D, D + can, 1);
      D += can;
      markRow(D, L, R, 1);
    }
    if (checkValid()) return 0;
    return cout << -1 << endl, 0;
  } else {
    int need = H - W;
    if (canExpandL() || (L == R && L >= need)) {
      int can = min(need, L);
      markCol(L, U, D, 0);
      markRow(U, L - can, L, 1);
      markRow(D, L - can, L, 1);
      L -= can;
      markCol(L, U, D, 1);
    }
    if (checkValid()) return 0;
    W = R - L + 1, H = D - U + 1;
    need = H - W;
    if (canExpandR() || L == R) {
      int can = min(need, m - R - 1);
      markCol(R, U, D, 0);
      markRow(U, R, R + can, 1);
      markRow(D, R, R + can, 1);
      R += can;
      markCol(R, U, D, 1);
    }
    if (checkValid()) return 0;
    return cout << -1 << endl, 0;
  }
  return 0;
}
