func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5e3 + 1;   int dp[N][N];   bool palid[N][N];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     string s;     cin >> s;     int n = s.size();     for (int d = 0; d < n; d++)       for (int i = 0; i < n; i++) {         int j = i + d;         if (j >= n) continue;         palid[i][j] = (s[i] == s[j]);         if (i + 1 <= j - 1) palid[i][j] &= palid[i + 1][j - 1];       }     for (int d = 0; d < n; d++)       for (int i = 0; i < n; i++) {         int j = i + d;         if (j >= n) continue;         dp[i][j] = palid[i][j];         if (i + 1 <= j) dp[i][j] += dp[i + 1][j];         if (i <= j - 1) dp[i][j] += dp[i][j - 1];         if (i + 1 <= j - 1) dp[i][j] -= dp[i + 1][j - 1];       }     int q;     cin >> q;     for (int i = 0; i < q; i++) {       int l, r;       cin >> l >> r;       l--;       r--;       cout << dp[l][r] <<   n ;     }     return 0;   }   