human
Find if string is K | Find if string is K - Palindrome or not using all characters exactly once Python 3 program to find if string is K - Palindrome or not using all characters exactly once.
when size of string is less than k.
when size of string is equal to k.
when size of string is greater than k to store the frequencies of the characters.
to store the count of characters whose number of occurrences is odd ..
iterating over the map.
Driver code"
Solution in Python:
 ... Give me a code to find if string is K and the other steps required?
assistant
#Here is code to find if string is K and the other steps required.
 def iskPalindromesPossible ( s , k ) :
	if ( len ( s ) < k ) :
		print ( " Not ▁ Possible " )
		return
	if ( len ( s ) == k ) :
		print ( " Possible " )
		return
	freq = dict . fromkeys ( s , 0 )
	for i in range ( len ( s ) ) :
		freq [ s [ i ] ] += 1
	count = 0
	for value in freq . values ( ) :
		if ( value % 2 == 1 ) :
			count += 1
	if ( count > k ) :
		print ( " No " )
	else :
		print ( " Yes " )
if __name__ == ' _ _ main _ _ ' :
	str1 = " poor "
	K = 3
	iskPalindromesPossible ( str1 , K )
	str = " geeksforgeeks "
	K = 10
	iskPalindromesPossible ( str , K )