#Is the word an anagram of a palindrome?

# A palindrome is a word that reads the same forward and backwards (eg, “racecar”, “tacocat”). An anagram is a rescrambling of a word (eg for “racecar”, you could rescramble this as “arceace”).

# Determine if the given word is a re-scrambling of a palindrome.

# The word will only contain lowercase letters, a-z.

def is_anagram_of_palindrome(word):
    """Is the word an anagram of a palindrome?"""

    seen = {}
    #count each letter

    for letter in word:
        if letter in seen:
            seen[letter] += 1
        else:
            seen[letter] = 1

    # It's a palindrome if the number of odd-counts is either 0 or 1
    seen_an_odd = False

    for count in seen.values():
        if count % 2 != 0:
            if seen_an_odd:
                return False
            seen_an_odd = True

    return True 