#include <bits/stdc++.h>
using namespace std;
char Map[2111][2111];
int sum[2111][2111];
int n, m, tot;
int l, r;
int x, y;
int ans;
bool check(int x) {
  for (int i = (1); i <= (n - x + 1); i++)
    for (int j = (1); j <= (m - x + 1); j++) {
      int x1 = i, x2 = i + x - 1, y1 = j, y2 = j + x - 1;
      int tmp =
          sum[x2][y2] - sum[x2][y1 - 1] - sum[x1 - 1][y2] + sum[x1 - 1][y1 - 1];
      if (tmp == tot) return true;
    }
  return false;
}
bool valid(int x, int y) {
  int x1 = x, x2 = x + ans - 1, y1 = y, y2 = y + ans - 1;
  int tmp =
      sum[x2][y2] - sum[x2][y1 - 1] - sum[x1 - 1][y2] + sum[x1 - 1][y1 - 1];
  if (tmp == tot) {
    x1++;
    x2--;
    y1++;
    y2--;
    bool flag = false;
    if ((x1 > x2) || (y1 > y2)) flag = true;
    tmp = sum[x2][y2] - sum[x2][y1 - 1] - sum[x1 - 1][y2] + sum[x1 - 1][y1 - 1];
    if (tmp == 0) flag = true;
    if (flag) return true;
  }
  return false;
}
void find() {
  for (int i = (1); i <= (n - ans + 1); i++)
    for (int j = (1); j <= (m - ans + 1); j++)
      if (valid(i, j)) {
        x = i;
        y = j;
        return;
      }
  puts("-1");
  exit(0);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (n); i++) {
    getchar();
    for (int j = (1); j <= (m); j++) {
      Map[i][j] = getchar();
      tot += (Map[i][j] == 'w');
      sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] +
                  (Map[i][j] == 'w');
    }
  }
  for (l = 1, r = min(n, m); l <= r;) {
    if (check((l + r) / 2))
      ans = (l + r) / 2, r = (l + r) / 2 - 1;
    else
      l = (l + r) / 2 + 1;
  }
  if (ans == 0) {
    puts("-1");
    return 0;
  }
  find();
  int x1 = x, x2 = x + ans - 1, y1 = y, y2 = y + ans - 1;
  for (int i = (0); i < (ans); i++) {
    if (Map[x1][y1 + i] == '.') Map[x1][y1 + i] = '+';
    if (Map[x2][y1 + i] == '.') Map[x2][y1 + i] = '+';
    if (Map[x1 + i][y1] == '.') Map[x1 + i][y1] = '+';
    if (Map[x1 + i][y2] == '.') Map[x1 + i][y2] = '+';
  }
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (m); j++) putchar(Map[i][j]);
    puts("");
  }
}
