#include <bits/stdc++.h>
using namespace std;
char str[2200][2200];
int vis[2200][2200];
int main() {
  int n, m, i, j, k, p, q;
  while (cin >> n >> m) {
    for (i = 0; i < n; i++) cin >> str[i];
    memset(vis, 0, sizeof(vis));
    int r1 = 100000, r2 = -100000, c1 = 1000000, c2 = -100000, size = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++)
        if (str[i][j] == 'w') {
          r1 = min(r1, i);
          r2 = max(r2, i);
          c1 = min(c1, j);
          c2 = max(c2, j);
          vis[i][j] = 1;
          size++;
        }
    }
    int r = max(r2 - r1 + 1, c2 - c1 + 1);
    bool yes = true;
    for (i = r1 + 1; i < r2; i++)
      for (j = c1 + 1; j < c2; j++)
        if (str[i][j] == 'w') yes = false;
    if (yes == false) {
      puts("-1");
      continue;
    }
    bool ok = false;
    if (r2 - r1 + 1 < r) {
      if (r1 == r2) {
        if (size == 2) {
          while (r1 >= 0) {
            r2 = r + r1 - 1;
            if (r2 < n) break;
            r1--;
          }
          if (r1 < 0) {
            puts("-1");
            continue;
          }
        } else {
          if (r1 + 1 - r >= 0)
            r1 = r1 + 1 - r;
          else if (r + r2 - 1 < n)
            r2 = r + r2 - 1;
          else {
            puts("-1");
            continue;
          }
        }
      } else {
        int nowr = r2;
        while (nowr < n) {
          for (i = c1 + 1; i < c2; i++)
            if (str[nowr][i] == 'w') {
              nowr = 100000;
              break;
            }
          if (nowr - r1 + 1 <= r) {
            r2 = nowr;
            if (nowr - r1 + 1 == r) {
              ok = true;
              break;
            }
          }
          nowr++;
        }
        if (ok == false) {
          nowr = r1;
          while (nowr >= 0) {
            for (i = c1 + 1; i < c2; i++)
              if (str[nowr][i] == 'w') {
                nowr = -10;
                break;
              }
            if (r2 - nowr + 1 <= r) {
              r1 = nowr;
              if (r2 - nowr + 1 == r) {
                ok = true;
                break;
              }
            }
            nowr--;
          }
        }
        if (ok == false) {
          puts("-1");
          continue;
        }
      }
    }
    if (c2 - c1 + 1 < r) {
      if (c1 == c2) {
        if (size == 2) {
          while (c1 >= 0) {
            c2 = r + c1 - 1;
            if (c2 < m) break;
            c1--;
          }
          if (c1 < 0) {
            puts("-1");
            continue;
          }
        } else {
          if (c1 + 1 - r >= 0)
            c1 = c1 + 1 - r;
          else if (r + c2 - 1 < m)
            c2 = r + c2 - 1;
          else {
            puts("-1");
            continue;
          }
        }
      } else {
        ok = false;
        int nowc = c2;
        while (nowc < m) {
          for (i = r1 + 1; i < r2; i++)
            if (str[i][nowc] == 'w') {
              nowc = 1000000;
              break;
            }
          if (nowc - c1 + 1 <= r) {
            c2 = nowc;
            if (nowc - c1 + 1 == r) {
              ok = true;
              break;
            }
          }
          nowc++;
        }
        if (ok == false) {
          nowc = c1;
          while (nowc >= 0) {
            for (i = r1 + 1; i < r2; i++)
              if (str[i][nowc] == 'w') {
                nowc = -10;
                break;
              }
            if (c2 - nowc + 1 <= r) {
              c1 = nowc;
              if (c2 - nowc + 1 == r) {
                ok = true;
                break;
              }
            }
            nowc--;
          }
        }
        if (ok == false) {
          puts("-1");
          continue;
        }
      }
    }
    for (i = r1; i <= r2; i++) {
      if (str[i][c1] != 'w') str[i][c1] = '+';
      if (str[i][c2] != 'w') str[i][c2] = '+';
    }
    for (i = c1; i <= c2; i++) {
      if (str[r1][i] != 'w') str[r1][i] = '+';
      if (str[r2][i] != 'w') str[r2][i] = '+';
    }
    for (i = 0; i < n; i++) puts(str[i]);
  }
  return 0;
}
