#include <bits/stdc++.h>
using namespace std;
int n, m;
int cnt_w = 0;
int a[2005][2005];
bool is_correct(int x, int y, int sz) {
  int new_cnt = 0;
  bool fl = true;
  if (sz > 1) {
    for (int j = y; j < y + sz - 1; j++) {
      if (j < n) {
        if (a[j][x] == 1) {
          new_cnt++;
        }
      } else {
        fl = false;
      }
    }
    for (int i = x; i < x + sz - 1; i++) {
      if (y + sz - 1 < n && i < m) {
        if (a[y + sz - 1][i] == 1) {
          new_cnt++;
        }
      } else {
        fl = false;
      }
    }
    for (int j = y + sz - 1; j > y; j--) {
      if (j < n && x + sz - 1 < m) {
        if (a[j][x + sz - 1] == 1) {
          new_cnt++;
        }
      } else {
        fl = false;
      }
    }
    for (int i = x + sz - 1; i > x; i--) {
      if (y < n && i < m) {
        if (a[y][i] == 1) {
          new_cnt++;
        }
      } else {
        fl = false;
      }
    }
  } else {
    if (a[y][x] == 1) {
      new_cnt++;
    }
  }
  if (new_cnt != cnt_w) {
    fl = false;
  }
  if (fl) {
    for (int j = y; j < y + sz - 1; j++) {
      if (a[j][x] == 0) {
        a[j][x] = 2;
      }
    }
    for (int i = x; i < x + sz - 1; i++) {
      if (a[y + sz - 1][i] == 0) {
        a[y + sz - 1][i] = 2;
      }
    }
    for (int j = y + sz - 1; j > y; j--) {
      if (a[j][x + sz - 1] == 0) {
        a[j][x + sz - 1] = 2;
      }
    }
    for (int i = x + sz - 1; i > x; i--) {
      if (a[y][i] == 0) {
        a[y][i] = 2;
      }
    }
  }
  return fl;
}
int main() {
  scanf("%d%d", &n, &m);
  int max_x = INT_MIN;
  int max_y = INT_MIN;
  int min_x = INT_MAX;
  int min_y = INT_MAX;
  for (int i = 0; i < n; i++) {
    string s;
    char q[m + 1];
    scanf("%s", q);
    s = q;
    for (int j = 0; j < m; j++) {
      if (s[j] == 'w') {
        a[i][j] = 1;
        max_x = max(j, max_x);
        min_x = min(min_x, j);
        max_y = max(max_y, i);
        min_y = min(min_y, i);
        cnt_w++;
      } else {
        a[i][j] = 0;
      }
    }
  }
  int d_x = max_x - min_x + 1;
  int d_y = max_y - min_y + 1;
  int d = max(d_x, d_y);
  if (d == d_x) {
    bool fl = false;
    for (int i = 0; i < n; i++) {
      if (!fl) {
        bool can_exist = is_correct(min_x, i, d);
        if (can_exist) {
          fl = true;
          for (int l = 0; l < n; l++) {
            for (int k = 0; k < m; k++) {
              if (a[l][k] == 0) {
                cout << '.';
              }
              if (a[l][k] == 1) {
                cout << 'w';
              }
              if (a[l][k] == 2) {
                cout << '+';
              }
            }
            cout << endl;
          }
        }
      }
    }
    if (!fl) {
      cout << -1;
    }
  } else {
    bool fl = false;
    for (int i = 0; i < m; i++) {
      if (!fl) {
        bool can_exist = is_correct(i, min_y, d);
        if (can_exist) {
          fl = true;
          for (int l = 0; l < n; l++) {
            for (int k = 0; k < m; k++) {
              if (a[l][k] == 0) {
                cout << '.';
              }
              if (a[l][k] == 1) {
                cout << 'w';
              }
              if (a[l][k] == 2) {
                cout << '+';
              }
            }
            cout << endl;
          }
        }
      }
    }
    if (!fl) {
      cout << -1;
    }
  }
  return 0;
}
