#include <bits/stdc++.h>   using namespace std;   int inf = 1000000000, mxx, mxy, mnx = inf, mny = inf, n, m, i, j, r = 0,       x[2000001], y[2000001];   char a[3001][3001], c[3001][3001];   bool ok(int mxx, int mxy, int mnx, int mny) {     for (int i = 0; i < r; i++)       if (x[i] < mnx || x[i] > mxx || y[i] < mny || y[i] > mxy ||           (x[i] != mxx && x[i] != mnx && y[i] != mxy && y[i] != mny))         return false;     return (mxx - mnx == mxy - mny && mxx < n && mxy < m && mnx >= 0 && mny >= 0);   }   void go(int mxx, int mxy, int mnx, int mny) {     int i, j;     for (i = 0; i < n; i++)       for (j = 0; j < m; j++) {         if (i >= mnx && i <= mxx && j >= mny && j <= mxy &&             ((i == mxx || i == mnx) || (j == mxy || j == mny)) && a[i][j] !=  w )           c[i][j] =  + ;         else           c[i][j] = a[i][j];       }   }   int main() {     cin >> n >> m;     for (i = 0; i < n; i++)       for (j = 0; j < m; j++) {         cin >> a[i][j];         if (a[i][j] ==  w ) {           x[r] = i;           y[r] = j;           r++;         }       }     for (i = 0; i < r; i++) {       if (x[i] > mxx) mxx = x[i];       if (y[i] > mxy) mxy = y[i];       if (x[i] < mnx) mnx = x[i];       if (y[i] < mny) mny = y[i];     }     for (i = 0; i <= m; i++) {       if (ok(mxx, i + (mxx - mnx), mnx, i)) {         go(mxx, i + (mxx - mnx), mnx, i);         for (i = 0; i < n; i++)           for (j = 0; j < m; j++) {             cout << c[i][j];             if (j == m - 1) cout << endl;           }         return 0;       }     }     for (i = 0; i <= n; i++) {       if (ok(i + (mxy - mny), mxy, i, mny)) {         go(i + (mxy - mny), mxy, i, mny);         for (i = 0; i < n; i++)           for (j = 0; j < m; j++) {             cout << c[i][j];             if (j == m - 1) cout << endl;           }         return 0;       }     }     cout <<  -1 ;   }   