Are they all palindromes?

You are given a string s and a length ℓ. Are all the substrings of
length ℓ of s palindromes?

For instance, let s= “ababa” and ℓ = 3. Here, we have s[0..2]= “aba”,
s[1..3]= “bab” and s[2..4]= “aba”. Since the three substrings of s of
length 3 are palindomes, in this case the answer is positive.

Input

Input consists of several cases, each with s and ℓ. Let n be the size of
s. You can assume 1 ≤ ℓ ≤ n ≤ 10⁵, and that s is made up of only
lowercase letters.

Output

For every case, print “yes” or “no”.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:12:41.353Z

© Jutge.org, 2006–2026.
https://jutge.org
