func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MaxN = 5e2 + 10;   const int P = 239017;   const int INF = 1e9;   const int MOD = 1e9 + 7;   int dp[MaxN][MaxN][2], n, m, q;   char s[MaxN][MaxN];   int get(int xl, int yl, int xr, int yr, int c) {     if (c == 0 && xl > xr) {       return 0;     }     if (c == 1 && yl > yr) {       return 0;     }     return dp[xr][yr][c] + dp[xl - 1][yl - 1][c] - dp[xr][yl - 1][c] -            dp[xl - 1][yr][c];   }   int main() {     scanf( %d%d n , &n, &m);     for (int i = 1; i <= n; ++i) {       gets(s[i] + 1);     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         dp[i][j][0] = dp[i - 1][j][0] + dp[i][j - 1][0] - dp[i - 1][j - 1][0] +                       (s[i - 1][j] == s[i][j] && s[i][j] ==  . );         dp[i][j][1] = dp[i - 1][j][1] + dp[i][j - 1][1] - dp[i - 1][j - 1][1] +                       (s[i][j - 1] == s[i][j] && s[i][j] ==  . );       }     }     scanf( %d , &q);     while (q-- > 0) {       int xl, yl, xr, yr;       scanf( %d%d%d%d , &xl, &yl, &xr, &yr);       printf( %d n , get(xl + 1, yl, xr, yr, 0) + get(xl, yl + 1, xr, yr, 1));     }     return 0;   }   