Suppose we have a string; we have to check whether characters of the given string can be shuffled to make a palindrome or not.
So, if the input is like s = "aarcrce", then the output will be True as we can shuffle characters to form "racecar" which is a palindrome.
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
size = 256 def solve(s) : freq =  * size for i in range( 0, len(s)) : freq[ord(s[i])] = freq[ord(s[i])] + 1 odd_count = 0 for i in range(0, size) : if freq[i] % 2 == 1 : odd_count = odd_count + 1 if odd_count > 1: return False return True s = "aarcrce" print(solve(s))