#K47012. Contains Palindrome Query

    ID: 28104 Type: Default 1000ms 256MiB

Contains Palindrome Query

Contains Palindrome Query

You are given a string S and a number of queries. For each query, determine whether there exists a substring of S of a specified length that is a palindrome. A string (or substring) is a palindrome if it reads the same backwards as forwards. Formally, for a substring P of S with length \(Q\), P is a palindrome if \(P = \text{reverse}(P)\). For each query, output Yes if such a substring exists and No otherwise.

inputFormat

The input is given in the following format:

  1. The first line contains the string S.
  2. The second line contains an integer N representing the number of queries.
  3. The third line contains N space-separated integers. Each integer represents a query for the length of the substring to check.

outputFormat

For each query, output Yes if there is at least one substring of length Q that is a palindrome, and No otherwise. Each answer should be printed on a separate line.

## sample
abacaba
1
3
Yes

</p>