import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class solution{ public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); int q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ int l = in.nextInt(); int r = in.nextInt(); String str = s, word=""; str = str + ' '; String s1= s.substring(l,r); int palno=0; for(int h=0;h=0;i--) { char ch=s1.charAt(i); rev=rev+ch; } result=s1.equals(rev); if(result==true) { palno++; System.out.println(palno); } } } System.out.println(palno); } } }