func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   int R, C;   string t[2222];   int s1[2222][2222];   int main() {     memset(s1, 0, sizeof(s1));     cin >> R >> C;     for (int r = 0; r < (int)R; r++) {       cin >> t[r];       for (int c = 0; c < (int)C; c++) {         if (t[r][c] ==  w ) {           s1[r + 1][c + 1]++;         }       }     }     for (int r = 0; r < (int)2221; r++) {       for (int c = 0; c < (int)2221; c++) {         s1[r + 1][c + 1] += (s1[r + 1][c] + s1[r][c + 1] - s1[r][c]);       }     }     int lo = 0;     int hi = max(R, C);     while (lo < hi - 1) {       int len = (lo + hi) / 2;       bool isSome = false;       for (int r = 0; r + len - 1 < max(R, C); r++) {         for (int c = 0; c + len - 1 < max(R, C); c++) {           if (s1[r + len][c + len] - s1[r + len][c] - s1[r][c + len] + s1[r][c] ==               s1[2221][2221]) {             isSome = true;             break;           }         }         if (isSome) break;       }       if (isSome)         hi = len;       else         lo = len;     }     cerr << hi << endl;     bool done = false;     for (int r = 0; r + hi - 1 < R; r++) {       for (int c = 0; c + hi - 1 < C; c++) {         int big = s1[r + hi][c + hi] - s1[r][c + hi] - s1[r + hi][c] + s1[r][c];         int small = 0;         if (hi != 1 && hi != 2) {           small = s1[r + hi - 1][c + hi - 1] - s1[r + 1][c + hi - 1] -                   s1[r + hi - 1][c + 1] + s1[r + 1][c + 1];         }         if (big - small == s1[2221][2221]) {           for (int i = 0; i < hi; i++) {             if (t[r][c + i] ==  . ) t[r][c + i] =  + ;             if (t[r + hi - 1][c + i] ==  . ) t[r + hi - 1][c + i] =  + ;             if (t[r + i][c] ==  . ) t[r + i][c] =  + ;             if (t[r + i][c + hi - 1] ==  . ) t[r + i][c + hi - 1] =  + ;           }           done = true;           break;         }         if (done) break;       }       if (done) break;     }     if (done) {       for (int r = 0; r < (int)R; r++) {         for (int c = 0; c < (int)C; c++) {           cout << t[r][c];         }         cout << endl;       }       cout << endl;     } else {       cout << -1 << endl;     }     return 0;   }   