#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int ddx[] = {0, 0, 1, 1, 1, -1, -1, -1}, ddy[] = {1, -1, 1, 0, -1, 1, 0, -1};
int n, m;
char s[2002][2002];
int cnt[2002][2002];
int cc(int a, int b, int c, int d) {
  return cnt[c][d] - cnt[a - 1][d] - cnt[c][b - 1] + cnt[a - 1][b - 1];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int(i) = (1); (i) <= (n); (i) += (1)) scanf("%s", s[i] + 1);
  int mnx = 987654321, mxx = -1, mny = 987654321, mxy = -1;
  for (int(i) = (1); (i) <= (n); (i) += (1))
    for (int(j) = (1); (j) <= (m); (j) += (1)) {
      if (s[i][j] == 'w') {
        cnt[i][j]++;
        mnx = min(mnx, i);
        mxx = max(mxx, i);
        mny = min(mny, j);
        mxy = max(mxy, j);
      }
      cnt[i][j] += cnt[i - 1][j] + cnt[i][j - 1] - cnt[i - 1][j - 1];
    }
  int t = max(mxx - mnx, mxy - mny);
  if (t == 0) {
    for (int(i) = (1); (i) <= (n); (i) += (1)) printf("%s\n", s[i] + 1);
    return 0;
  }
  for (int(i) = (1); (i) <= (n); (i) += (1)) {
    for (int(j) = (1); (j) <= (m); (j) += (1)) {
      if (i + t > n || j + t > m) break;
      if (cc(i, j, i + t, j + t) != cnt[n][m]) continue;
      if (t >= 2 && cc(i + 1, j + 1, i + t - 1, j + t - 1) > 0) continue;
      for (int(ii) = (0); (ii) <= (t); (ii) += (1)) {
        if (s[i + ii][j] == '.') s[i + ii][j] = '+';
        if (s[i + ii][j + t] == '.') s[i + ii][j + t] = '+';
        if (s[i][j + ii] == '.') s[i][j + ii] = '+';
        if (s[i + t][j + ii] == '.') s[i + t][j + ii] = '+';
      }
      for (int(i) = (1); (i) <= (n); (i) += (1)) printf("%s\n", s[i] + 1);
      return 0;
    }
  }
  puts("-1");
}
