#include <bits/stdc++.h>
using namespace std;
const int NMax = 2100, MMax = 200;
int N, M;
char A[NMax][NMax];
vector<pair<int, int> > S;
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++) scanf("%s", A[i]);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++)
      if (A[i][j] == 'w') S.push_back(make_pair(i + 1, j + 1));
  int minx = 5000, miny = 5000, maxx = -1, maxy = -1;
  for (int i = 0; i < S.size(); i++) {
    minx = min(minx, S[i].first);
    miny = min(miny, S[i].second);
    maxx = max(maxx, S[i].first);
    maxy = max(maxy, S[i].second);
  }
  for (int i = 0; i < S.size(); i++) {
    if ((S[i].first != minx && S[i].first != maxx) &&
        (S[i].second != miny && S[i].second != maxy)) {
      puts("-1");
      return 0;
    }
  }
  int get = max(maxx - minx + 1, maxy - miny + 1);
  if (maxx - minx + 1 == get) {
    int t = maxy - miny + 1, flag1 = 0, flag2 = 0;
    for (int i = 0; i < S.size(); i++) {
      if (S[i].second == miny && S[i].first > minx && S[i].first < maxx)
        flag1 = 1;
      if (S[i].second == maxy && S[i].first > minx && S[i].first < maxx)
        flag2 = 1;
    }
    if (flag1 && flag2 && get != t && t != 1) {
      puts("-1");
      return 0;
    }
    if (flag1 && !flag2) maxy = miny + get - 1;
    if (!flag1 && flag2) miny = maxy - get + 1;
    if ((!flag1 && !flag2) || t == 1) {
      if (miny + get - 1 <= M)
        maxy = miny + get - 1;
      else
        miny = maxy - get + 1;
    }
    if (maxy > M && M <= get) {
      maxy = M;
      miny = M - get + 1;
    }
    if (miny < 1 && M <= get) {
      miny = 1;
      maxy = miny + get - 1;
    }
    if (maxy > M || miny < 1) {
      puts("-1");
      return 0;
    }
  } else {
    int t = maxx - minx + 1, flag1 = 0, flag2 = 0;
    for (int i = 0; i < S.size(); i++) {
      if (S[i].first == minx && S[i].second > miny && S[i].second < maxy)
        flag1 = 1;
      if (S[i].first == maxx && S[i].second > miny && S[i].second < maxy)
        flag2 = 1;
    }
    if (flag1 && flag2 && get != t && t != 1) {
      puts("-1");
      return 0;
    }
    if (flag1 && !flag2) maxx = minx + get - 1;
    if (!flag1 && flag2) minx = maxx - get + 1;
    if ((!flag1 && !flag2) || t == 1) {
      if (minx + get - 1 <= N)
        maxx = minx + get - 1;
      else
        minx = maxx - get + 1;
    }
    if (maxx > N && N <= get) {
      maxx = N;
      minx = N - get + 1;
    }
    if (minx < 1 && N <= get) {
      minx = 1;
      maxx = minx + get - 1;
    }
    if (maxx > N || minx < 1) {
      puts("-1");
      return 0;
    }
  }
  for (int i = miny; i <= maxy; i++) {
    if (A[minx - 1][i - 1] != 'w') A[minx - 1][i - 1] = '+';
    if (A[maxx - 1][i - 1] != 'w') A[maxx - 1][i - 1] = '+';
  }
  for (int i = minx + 1; i < maxx; i++) {
    if (A[i - 1][miny - 1] != 'w') A[i - 1][miny - 1] = '+';
    if (A[i - 1][maxy - 1] != 'w') A[i - 1][maxy - 1] = '+';
  }
  for (int i = 0; i < N; i++) printf("%s\n", A[i]);
  return 0;
}
