Python: T/M - 92%/90% (Mathematical/Combinatorial)
Intuition\n Describe your first thoughts on how to solve this problem. \nThe nature of this problem really defines it as more of a combinatorics problem wrapped
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe nature of this problem really defines it as more of a combinatorics problem wrapped in a simple coding problem. \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFrom the [product rule](https://en.wikipedia.org/wiki/Rule_of_product) and the problem description we can first deduce that \n$$|\\{\\textbf{# of anagrams of w}\\}| = \\prod_{i=1}^{m}|\\{\\textbf{# of anagrams of } w_i\\}|\\\\$$ where $$w_i$$ is the i-th word in the string w with m total words.\n\nThis product can be taken with a simple for-loop which loops over all the words which is what I did. \n\nNext we just need to count the number of anagrams for any given word $$w_i$$. Next we take the formula [here](https://en.wikipedia.org/wiki/Combination#Number_of_ways_to_put_objects_into_bins) and think of each of the n positions in the word $$w_i$$ as individual items and each of the distinct letter types as having their own bin with a size of however many copies of that letter there are in the word. So if we take any word v with n letters in it and $l$ different types of letter each with $k_j$ copies of every j-th letter then\n$$|\\{\\textbf{# of anagrams of } v\\}|={n \\choose k_1,k_2,\\cdots k_l}$$\n\nNote that each of the values, $k_j$, can be found by simply counting the number of each letter in the word by creating a dictionary with the \'Counter\' function. Since the order of these values does not matter we can take the values of the dictionary in no particular order.\n\nFurther inspecting the defintion of the multinomial formula you can see that\n\n$${n \\choose k_1,k_2,\\cdots k_l}={n \\choose k_1}{n-k_1 \\choose k_2}{n-k_1-k_2\\choose k_3}\\cdots{n-k_1-\\cdots k_{l-1}\\choose k_l}$$ \n\nwhich can be computed using the \'comb\' function and an inner for-loop. \n\nAssuming that the words are english, the size of each word is bounded so we can take \'comb\' as running in $$O(1)$$ time.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n# Code\n```\nfrom math import comb\nclass Solution:\n    def countAnagrams(self, s: str) -> int:\n        anagrams = 1\n        s = s.split()\n        for word in s:\n            counts = list(Counter(word).values())\n            n = sum(counts)\n            for count in counts:\n                anagrams *= comb(n,count)\n                n -= count\n        return anagrams % 1000000007\n```
['Math', 'Combinatorics', 'Counting', 'Python3']