#C6862. Palindromic Substring Partitioning

    ID: 50669 Type: Default 1000ms 256MiB

Palindromic Substring Partitioning

Palindromic Substring Partitioning

You are given a string s consisting of lowercase English letters and q queries. Each query is described by two integers l and r (1-indexed) which define the substring s[l...r].

It is guaranteed that for every query the selected substring is a palindrome. Your task is to determine the minimum number of palindromic substrings that the substring s[l...r] can be partitioned into. Given the guarantee, the answer for each query is 1.

Note: Even though the problem seems trivial under the given constraints, you should implement the solution in a robust way that reads from standard input and writes to standard output.

Formula:
For every valid query, if S = s[l...r] is a palindrome, then

[ \text{answer} = 1 ]

inputFormat

The input is given in the following format:

<string s>
<integer q>
<l1> <r1>
<l2> <r2>
... 
<lq> <rq>

Here, s is a string of lowercase letters, q is the number of queries, and for each query, l and r represent the 1-indexed start and end indices of the substring.

outputFormat

For each query, output a single integer representing the minimum number of palindromic substrings the substring s[l...r] can be partitioned into. Since it is guaranteed that each queried substring is a palindrome, the answer will always be 1.

Each answer should be printed on a new line.

## sample
ababa
3
1 5
1 3
2 4
1

1 1

</p>