<jupyter_start><jupyter_text>Write a function that, given a string, determines whether any permutation of that string is a palindrome. Examples:- "civic" should return True- "ivicc" should return True- "civil" should return False- "livci" should return FalseYes, yes, "ivicc" itself is not a palindrome, but it can be rearranged into a valid palindrome, i.e. "icvci", which is a valid palindrome.<jupyter_code># imports.
from collections import Counter

# set # of characters.
NO_OF_CHARS = 256
# permutation palindrome function.
def is_permutation_palindrome(string):
  
    # create a count array and initialize.   
    # all values as 0. 
    count = [0] * (NO_OF_CHARS) 
  
    # for each character in input strings, increment count in the corresponding count array.
    for i in range( 0, len(string)) : 
        count[ord(string[i])] = count[ord(string[i])] + 1
  
    # count odd occurring characters. 
    odd = 0
      
    for i in range(0, NO_OF_CHARS ) : 
        if (count[i] & 1) : 
            odd = odd + 1
  
        if (odd > 1) : 
            return False
              
    # return true if odd count is 0 or 1.  
    return True
  
# driver program.

# show results for civic.
if(is_permutation_palindrome("civic")) : 
    print("True") 
else : 
    print("False") 
# show results for ivicc.      
if(is_permutation_palindrome("ivicc")) : 
    print("True") 
else : 
    print("False")
# show results for civil.
if(is_permutation_palindrome("civil")) : 
    print("True") 
else : 
    print("False") 
# show results for livci.      
if(is_permutation_palindrome("livci")) : 
    print("True") 
else : 
    print("False")<jupyter_output>True
True
False
False
{'fraction_non_alphanumeric': 0.10429082240762813, 'fraction_numerical': 0.00834326579261025, 'mean_word_length': 2.8955916473317864, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '451125', 'license': 'MIT', 'n_tokens_mistral': 578, 'n_tokens_neox': 545, 'n_words': 177, 'path': 'Challenges/PermutationPalindromeChallenge.ipynb', 'repo_name': 'CVanchieri/LambdaSchool-DS-Challenges', 'size': '1678'}