An anagram is a word, a phrase, or a sentence formed from another by rearranging its letters. An example of this is "angel", which is an anagram of "glean".

Write a function that receives an array of words, and returns the total number of distinct pairs of anagramic words inside it.

Some examples:

- There are 2 anagrams in the array `["dell", "ledl", "abc", "cba"]`
- There are 7 anagrams in the array `["dell", "ledl", "abc", "cba", "bca", "bac"]`

Source: codewars | Difficulty: EASY

Starter code: def anagram_counter(words):
	

Solutions:
from collections import Counter

def anagram_counter(words):
	return sum((n * (n - 1) // 2 for n in Counter((''.join(sorted(x)) for x in words)).values()))


def anagram_counter(words):

	def is_anagrams(s1, s2):
		return sorted(s1) == sorted(s2)
	return 0 if not words else sum([1 for x in range(len(words) - 1) for y in range(x + 1, len(words)) if is_anagrams(words[x], words[y])])


from collections import Counter

def anagram_counter(words):
	return sum((n * (n - 1) >> 1 for n in Counter((''.join(sorted(word)) for word in words)).values()))


from collections import Counter

def anagram_counter(words):
	return sum((n * (n - 1) / 2 for n in Counter((frozenset(word) for word in words)).values()))


from collections import Counter
from itertools import combinations

def anagram_counter(words):
	return sum((1 for (a, b) in combinations((frozenset(Counter(w)) for w in words), 2) if a == b))


from collections import Counter

def anagram_counter(words):
	anag = Counter((tuple(sorted(Counter(w).items())) for w in words))
	return sum((n * (n - 1) // 2 for n in anag.values()))


def anagram_counter(words):
	anagrams = 0
	for (i, word) in enumerate(words):
		for wrd in [w for w in words if w != word and set(word) == set(w)]:
			anagrams += 1
	return anagrams / 2


def run_down(number):
	count = 0
	while number:
		count += number - 1
		number -= 1
	return count

def anagram_counter(words):
	sorts = list((''.join(sorted(word)) for word in words))
	unique = set(sorts)
	return sum((run_down(sorts.count(word)) for word in unique))