#include <bits/stdc++.h>
using namespace std;
template <typename typ>
void vout(vector<typ>& v) {
  for (int vint = 0; vint < (int)(v).size(); vint++) {
    cout << (v)[vint];
    if (vint == (int)(v).size() - 1)
      cout << endl;
    else
      cout << ' ';
  }
}
template <typename typ>
void arrout(typ* arr, int l) {
  for (int i = 0; i < l; i++) {
    cout << arr[i];
    if (i < l - 1)
      cout << ' ';
    else
      cout << endl;
  }
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
bool valid(int d, int ad, int n, int m) {
  int i = (d + ad - m + 1);
  if (i % 2) return false;
  i /= 2;
  int j = ad - i;
  if (i >= 0 && i < n && j >= 0 && j < m) return true;
  return false;
}
int main() {
  int n, m;
  cin >> n >> m;
  string board[n];
  for (int i = 0; i < n; ++i) cin >> board[i];
  int xMin = 3000, yMin = 3000, xMax = -1, yMax = -1;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (board[i][j] == 'w') {
        xMin = min(xMin, i);
        yMin = min(yMin, j);
        xMax = max(xMax, i);
        yMax = max(yMax, j);
      }
    }
  int(*dp)[2001] = new int[2001][2001];
  for (int i = 0; i < max(n, m); ++i)
    for (int j = 0; j < 2001; ++j) dp[i][j] = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
      if (board[i - 1][j - 1] == 'w') dp[i][j]++;
    }
  int len = xMax - xMin + 1, wid = yMax - yMin + 1;
  bool works = false;
  if (len < wid) {
    for (int lPad = 0; lPad <= wid - len; ++lPad) {
      xMin -= lPad;
      xMax += wid - len - lPad;
      if (xMin >= 0 && xMax < n &&
          ((yMax == yMin && xMax == xMin) ||
           dp[xMax][yMax] - dp[xMin + 1][yMax] - dp[xMax][yMin + 1] +
                   dp[xMin + 1][yMin + 1] ==
               0)) {
        works = true;
        break;
      }
      xMin += lPad;
      xMax -= wid - len - lPad;
    }
  } else {
    for (int lPad = 0; lPad <= len - wid; ++lPad) {
      yMin -= lPad;
      yMax += len - wid - lPad;
      if (yMin >= 0 && yMax < m &&
          ((yMax == yMin && xMax == xMin) ||
           dp[xMax][yMax] - dp[xMin + 1][yMax] - dp[xMax][yMin + 1] +
                   dp[xMin + 1][yMin + 1] ==
               0)) {
        works = true;
        break;
      }
      yMin += lPad;
      yMax -= len - wid - lPad;
    }
  }
  if (!works)
    cout << (-1) << endl;
  else {
    for (int i = xMin; i <= xMax; ++i)
      for (int j = yMin; j <= yMax; ++j) {
        if (i == xMin || i == xMax || j == yMin || j == yMax)
          if (board[i][j] != 'w') board[i][j] = '+';
      }
    for (int i = 0; i < n; ++i) cout << (board[i]) << endl;
  }
}
