#include <bits/stdc++.h>
using namespace std;
const int MX = 3009;
int n, m, white = 0;
int arr[MX][MX], sum[MX][MX];
int SUM(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1];
}
bool check(int x, int y, int len) {
  if (SUM(x, y, x + len - 1, y + len - 1) == white)
    return true;
  else
    return false;
}
void PRINT() {
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= m; i++) {
      if (arr[j][i] == 0) putchar('.');
      if (arr[j][i] == 1) putchar('w');
      if (arr[j][i] == 2) putchar('+');
    }
    cout << endl;
  }
}
int main() {
  char ch;
  int mxx = 0, mxy = 0;
  cin >> n >> m;
  memset(sum, 0, sizeof(sum));
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= m; i++) {
      cin >> ch;
      if (ch == '.')
        arr[j][i] = 0;
      else
        arr[j][i] = 1, white++, mxx = max(j, mxx), mxy = max(i, mxy);
    }
  }
  if (white == 1) {
    PRINT();
    return 0;
  }
  for (int j = 1; j <= m; j++) sum[1][j] = arr[1][j] + sum[1][j - 1];
  for (int j = 1; j <= n; j++) sum[j][1] = arr[j][1] + sum[j - 1][1];
  for (int j = 2; j <= n; j++)
    for (int i = 2; i <= m; i++)
      sum[j][i] = arr[j][i] + sum[j - 1][i] + sum[j][i - 1] - sum[j - 1][i - 1];
  int best = n + m, fx, fy;
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= m; i++) {
      int sol1 = mxx - j, sol2 = mxy - i;
      if (sol1 > 0 && j + sol1 <= n && i + sol1 <= m) {
        int x1 = j, y1 = i, x2 = j + sol1, y2 = i + sol1;
        if (sol1 == 1) {
          if (SUM(x1, y1, x2, y2) == white) {
            best = sol1 + 1;
            fx = j, fy = i;
          }
        } else {
          if (SUM(x1, y1, x2, y2) - SUM(x1 + 1, y1 + 1, x2 - 1, y2 - 1) ==
              white) {
            if (sol1 + 1 < best) {
              best = sol1 + 1;
              fx = j, fy = i;
            }
          }
        }
      }
      swap(sol1, sol2);
      if (sol1 > 0 && j + sol1 <= n && i + sol1 <= m) {
        int x1 = j, y1 = i, x2 = j + sol1, y2 = i + sol1;
        if (sol1 == 1) {
          if (SUM(x1, y1, x2, y2) == white) {
            best = sol1 + 1;
            fx = j, fy = i;
          }
        } else {
          if (SUM(x1, y1, x2, y2) - SUM(x1 + 1, y1 + 1, x2 - 1, y2 - 1) ==
              white) {
            if (sol1 + 1 < best) {
              best = sol1 + 1;
              fx = j, fy = i;
            }
          }
        }
      }
    }
  }
  if (best == n + m) {
    puts("-1");
    return 0;
  }
  int fx2 = fx + best - 1, fy2 = fy + best - 1;
  for (int j = fy; j <= fy2; j++) {
    if (arr[fx][j] == 0) arr[fx][j] = 2;
    if (arr[fx2][j] == 0) arr[fx2][j] = 2;
  }
  for (int j = fx; j <= fx2; j++) {
    if (arr[j][fy] == 0) arr[j][fy] = 2;
    if (arr[j][fy2] == 0) arr[j][fy2] = 2;
  }
  PRINT();
}
