#include #include using namespace std; // Returna total number of palindrome substring of // length greater then equal to 2 int CountPS(vector str, int n) { // creat empty 2-D matrix that counts all palindrome // substring. dp[i][j] stores counts of palindromic // substrings in st[i..j] int dp[n][n]; memset(dp, 0, sizeof(dp)); // P[i][j] = true if substring str[i..j] is palindrome, // else false bool P[n][n]; memset(P, false , sizeof(P)); // palindrome of single lenght for (int i= 0; i< n; i++) P[i][i] = true; // palindrome of length 2 for (int i=0; i>s; int q,l,r; cin>>q; while(q--){ vectorf; cin>>l>>r; for(int i=l-1;i