import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static String value; static void initialize(String s) { value = s; } static int answerQuery(int l, int r) { // creat empty 2-D matrix that counts all palindrome // substring. dp[i][j] stores counts of palindromic // substrings in st[i..j] char[] str = value.substring(l-1,r-1).toCharArray(); int n= str.length; int dp[][] = new int[n][n]; // P[i][j] = true if substring str[i..j] is palindrome, // else false boolean P[][] = new boolean[n][n]; // palindrome of single lenght for (int i= 0; i< n; i++) P[i][i] = true; // palindrome of length 2 for (int i=0; i