using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static string text; static void initialize(string s) { text = s; } static int answerQuery(int l, int r) { if(l < r) { string sub = text.Substring(l, r-l); if(sub == sub.Reverse()) { return 1; } else { return answerQuery(l + 1, r); } } return 0; } static void Main(String[] args) { string s = Console.ReadLine(); initialize(s); int q = Convert.ToInt32(Console.ReadLine()); for(int a0 = 0; a0 < q; a0++){ string[] tokens_l = Console.ReadLine().Split(' '); int l = Convert.ToInt32(tokens_l[0]); int r = Convert.ToInt32(tokens_l[1]); int result = answerQuery(l-1, r-1); Console.WriteLine(result); } } }