If the given string is “ninjas” and p = 4 then we can make 4 palindromic strings as “nin” + “j” + “a” + “s”.
The first line contains ‘T’ denoting the number of test cases.
The first line of each test case contains the string ‘S’.
The second line of each test case contains the integer ‘ p ’.
For each test case, print “True” if it is possible to construct ‘ p ’ palindromic strings from all letters of string ‘S’ and print “False” if it is not possible.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 50
1 <= |S| <= 10^5
1 <= p <= 10^5
Where |S| is the length of the string ‘ S ’
Time Limit: 1sec
Algorithm
Equal Arrays
Longest Subarray With Zero Sum
Ninja And The Strictly Increasing Array
Maximum GCD
Maximize