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.

murli01 | 343 |

decoder_101 | 216 |

Sulagna | 189 |

kya_bolti_public | 172 |

madhursengar24 | 172 |

PiyushPandey4 | 717 |

john_wick | 681 |

ASWATHAMA | 565 |

akhyasharma01 | 547 |

jagrit_ | 507 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.