func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 550;   char grid[maxn][maxn];   int rdp[maxn][maxn], cdp[maxn][maxn], dp[maxn][maxn];   int val[maxn][maxn];   int main() {     int n, m, q, c1, c2, r1, r2;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) scanf( %s , grid[i]);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (!i)           rdp[i][j] = 0;         else {           rdp[i][j] = rdp[i - 1][j];           if (grid[i][j] ==  .  && grid[i - 1][j] ==  . ) rdp[i][j]++;         }         if (!j)           cdp[i][j] = 0;         else {           cdp[i][j] = cdp[i][j - 1];           if (grid[i][j] ==  .  && grid[i][j - 1] ==  . ) cdp[i][j]++;         }       }     }     scanf( %d , &q);     while (q--) {       scanf( %d%d%d%d , &r1, &c1, &r2, &c2);       r1--, c1--, r2--, c2--;       int ans = 0;       for (int i = r1; i <= r2; i++) ans += cdp[i][c2] - cdp[i][c1];       for (int j = c1; j <= c2; j++) ans += rdp[r2][j] - rdp[r1][j];       cout << ans << endl;     }     return 0;   }   