Palindromic Strings
Submissions: 914   Accuracy:


  Difficulty: Medium   Marks: 4

Given a string you have to transform it into a palindrome . In order to acheive that you have to perform exactly k insertion of characters(you cannot perform any more or less number of insertions).Now you have to report whether the string can be converted to a palindrome by making exactly k insertions.

Input :
The first line contains the number of test cases T. For each test case the first line contains the length of the string N and the number of insertions k. The second line contains the string S.


Output :
For each test case, print "YES"(without quotes) if the string can be converted to a palindrome making exactly k insertions otherwise "NO"(without quotes).


Constraints :

1 ≤ T ≤ 100


The string consists of only lower case English Alphabets (a-z).


Input :


4 2


5 3


Output :




Explanation :

For the first test case abac can be transformed to cabbac (which is palindrome) adding two characters c and b.

For the second test case abcde cannot be transformed to palindrome using 3 insertions.

For the third test case ab can be transformed to cabac (which is palindrome) adding three characters a, c and c.

** For More Input/Output Examples Use 'Expected Output' option **

Author: Arnab Deb

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.