#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
void upmin(T& a, const U& b) {
  a = min<T>(a, b);
}
template <typename T, typename U>
void upmax(T& a, const U& b) {
  a = max<T>(a, b);
}
template <typename T>
void uniq(T& a) {
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
}
void fast_io() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
bool in_rect(int x, int y, int w, int h) {
  return 0 <= x && x < w && 0 <= y && y < h;
}
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
int main() {
  int h, w;
  while (cin >> h >> w) {
    static char c[2048][2048];
    for (int i = 0; i < (int)(h); i++) cin >> c[i];
    int total = 0;
    int low[2048], high[2048];
    static int sum_row[2048][2048], sum_col[2048][2048];
    memset(sum_row, 0, sizeof(sum_row));
    memset(sum_col, 0, sizeof(sum_col));
    for (int y = 0; y < (int)(h); y++) {
      low[y] = w + 100, high[y] = -100;
      for (int x = 0; x < (int)(w); x++) {
        sum_row[y][x + 1] = sum_row[y][x];
        sum_col[x][y + 1] = sum_col[x][y];
        if (c[y][x] == 'w') {
          ++total;
          upmin(low[y], x);
          high[y] = x;
          ++sum_row[y][x + 1];
          ++sum_col[x][y + 1];
        }
      }
    }
    const int inf = 1e8;
    int min_size = inf;
    int left, right, bottom, top;
    for (int y = 0; y < (int)(h); y++) {
      int w_in_range = 0;
      int any_x = -1;
      for (int ty = y; ty < h; ++ty) {
        int min_x = min(low[y], low[ty]);
        int max_x = max(high[y], high[ty]);
        int size = ty - y;
        if (size < min_size) {
          static vector<int> left_cand;
          left_cand.clear();
          if (any_x < 0)
            left_cand.push_back(max(0, max_x - size));
          else {
            left_cand.push_back(any_x);
            left_cand.push_back(any_x - size);
          }
          for (auto lx : left_cand) {
            int rx = lx + size;
            if (lx < 0 || rx >= w) continue;
            if (lx <= min_x && max_x <= rx || min_x > max_x) {
              int w_on_frame = 0;
              w_on_frame += sum_row[y][rx + 1] - sum_row[y][lx];
              if (y < ty) w_on_frame += sum_row[ty][rx + 1] - sum_row[ty][lx];
              if (y + 1 < ty) {
                w_on_frame += sum_col[lx][ty] - sum_col[lx][y + 1];
                w_on_frame += sum_col[rx][ty] - sum_col[rx][y + 1];
              }
              if (w_on_frame == total) {
                min_size = size;
                left = lx, right = rx;
                bottom = y, top = ty;
              }
            }
          }
        }
        if (y < ty) {
          if (low[ty] <= high[ty]) any_x = low[ty];
        }
      }
    }
    if (min_size == inf)
      cout << -1 << endl;
    else {
      for (int y = bottom; y <= top; ++y) {
        if (c[y][left] == '.') c[y][left] = '+';
        if (c[y][right] == '.') c[y][right] = '+';
      }
      for (int x = left; x <= right; ++x) {
        if (c[bottom][x] == '.') c[bottom][x] = '+';
        if (c[top][x] == '.') c[top][x] = '+';
      }
      for (int y = 0; y < (int)(h); y++) cout << c[y] << endl;
    }
  }
}
