#include <bits/stdc++.h>
double const PI = 4 * atan(1.0);
using namespace std;
int n, m, dp[2011][2011] = {0}, h[2011][2011], w[2011][2011];
string s[2011];
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
struct node {
  int x, z;
};
void wypisz(int u, int v, int h) {
  for (int i = u - h + 1; i <= u; i++) {
    if (s[i][v - 1] == '.') s[i][v - 1] = '+';
    if (s[i][v - h] == '.') s[i][v - h] = '+';
  }
  for (int i = v - h; i <= v - 1; i++) {
    if (s[u][i] == '.') s[u][i] = '+';
    if (s[u - h + 1][i] == '.') s[u - h + 1][i] = '+';
  }
  for (int i = 1; i <= n; i++) cout << s[i] << endl;
}
int main() {
  cin >> n >> m;
  int su = 0;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    for (int j = 1; j <= m; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
      w[i][j] = m + 1;
      h[i][j] = n + 1;
      if (s[i][j - 1] == 'w') {
        dp[i][j]++;
        su += 1;
        w[i][j] = j;
        h[i][j] = i;
      }
      if (i > 1) {
        w[i][j] = min(w[i - 1][j], w[i][j]);
        h[i][j] = min(h[i - 1][j], h[i][j]);
      }
      if (j > 1) {
        w[i][j] = min(w[i][j - 1], w[i][j]);
        h[i][j] = min(h[i][j - 1], h[i][j]);
      }
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int y = max(abs(i - h[i][j]), abs(j - w[i][j])) + 1;
      if (y > i || y > j) continue;
      if (y == 1) {
        if (su == 1) {
          wypisz(i, j, y);
          return 0;
        }
      } else {
        int tmp1 = dp[i][j] - dp[i - y][j] - dp[i][j - y] + dp[i - y][j - y];
        if (tmp1 < su) continue;
        if (y == 2) {
          if (tmp1 == su) {
            wypisz(i, j, y);
            return 0;
          }
        } else {
          int tmp2 = dp[i - 1][j - 1] - dp[i - y + 1][j - 1] -
                     dp[i - 1][j - y + 1] + dp[i - y + 1][j - y + 1];
          if (tmp2 == 0) {
            wypisz(i, j, y);
            return 0;
          }
        }
      }
    }
  cout << -1;
}
