Given a string, find out if the string is K-Palindrome or not. A k-palindrome string transforms into a palindrome on removing at most k characters from it.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains the integers N and K where N denotes the the length of the string.

The second line of each test case contains the string.

**Output:**

Print 1 if the given string is K-palindrome else print 0. Print the answer for each test case in a new line.

**Constraints:**

1<= T <=100

1<= N, K <=1000

**Example:**

**Input:**

1

8 1

abcdecba

**Output:**

1

**Explanation:**

Input : String - abcdecba, k = 1

Output : Yes

String can become palindrome by removing 1 character i.e. either d or e)

Author: Dharmesh

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.

hari32147 | 100 |

AtakanSarıoğlu | 83 |

geetyadav | 82 |

amitpandey19 | 81 |

AdityaRaj9 | 75 |

abducodes | 862 |

harshtyagi36 | 425 |

vamsikrishna55 | 323 |

sandipbhaumik | 321 |

arpit_anshuman | 319 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.