#C9893. Palindrome Substring Queries

    ID: 54036 Type: Default 1000ms 256MiB

Palindrome Substring Queries

Palindrome Substring Queries

You are given a string S and Q queries. Each query consists of two integers l and r such that \(0 \leq l \leq r < |S|\), where \(|S|\) denotes the length of the string. For each query, you are to determine whether the substring \(S[l:r+1]\) is a palindrome.

A string is called a palindrome if it reads the same backward as forward. Your task is to process all queries and print Yes for the queries where the corresponding substring is a palindrome, or No if it is not.

Note: The input is taken from stdin and output should be printed to stdout. Each result should be printed on a new line.

inputFormat

The first line of input contains the string S.

The second line contains an integer Q, the number of queries.

Each of the following Q lines contains two integers l and r separated by a space, representing a query.

outputFormat

For each query, output a single line containing either Yes if the substring S[l:r+1] is a palindrome, or No otherwise.

## sample
racecar
3
0 6
1 5
2 4
Yes

Yes Yes

</p>