Are they all palindromes? P21691


Statement
 

pdf   zip

You are given a string ss and a length \ell. Are all the substrings of length \ell of ss palindromes?

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

Input

Input consists of several cases, each with ss and \ell. Let nn be the size of ss. You can assume 1n1051 \le \ell \le n \le 10^5, and that ss is made up of only lowercase letters.

Output

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

Public test cases
  • Input

    ababa 3
    abracadabra 5
    zz 2
    

    Output

    yes
    no
    yes
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++