Given a hash of letters and the number of times they occur, recreate all of the possible anagram combinations that could be created using all of the letters, sorted alphabetically.
The inputs will never include numbers, spaces or any special characters, only lowercase letters a-z.
E.g. get_words({2=>["a"], 1=>["b", "c"]}) => ["aabc", "aacb", "abac", "abca", "acab", "acba", "baac", "baca", "bcaa", "caab", "caba", "cbaa"]
from itertools import permutations

def get_words(letters):
    word = "".join(qty * char for qty in letters for chars in letters[qty] for char in chars)
    return sorted({"".join(permutation) for permutation in permutations(word)})
from itertools import permutations

def get_words(letters):
    word = "".join(qty * char for qty in letters for chars in letters[qty] for char in chars)
    return sorted({"".join(permutation) for permutation in permutations(word)})