import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Stack sta = new Stack<>(); static Queue que = new LinkedList<>(); static void initialize(String s) { // This function is called once before all queries. char[] ca = s.toCharArray(); for(char c:ca){ sta.push(c); que.add(c); } } static int answerQuery(int l, int r) { // Return the answer for this query modulo 1000000007. for(int i=0;ir;i--){que.remove();} boolean isPalin = true; while(!sta.isEmpty() && !que.isEmpty()){ if(sta.pop()!=que.remove()){ isPalin = false; break;} } if(isPalin){System.out.println("Is a Palin");} return 2; } public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); initialize(s); int q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ int l = in.nextInt(); int r = in.nextInt(); int result = answerQuery(l, r); System.out.println(result); } in.close(); } }