Finest way of solving Count ANAGRAMS problem
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def countAnagrams(self, s: str) -> int:
        MOD = 10**9 + 7
        max_n = 10**5
        fact = [1] *( max_n + 1)
        inv_fact = [1] *( max_n + 1)
        for i in range (2,max_n+1):
            fact[i] = (fact[i-1] *i) % MOD
        inv_fact[max_n] = pow (fact[max_n],MOD-2,MOD)
        for i in range(max_n-1 , 0 , -1):
            inv_fact[i] = (inv_fact[i+1] * (i+1)) % MOD
        words = s.split()
        t = 1
        for w in words :
            frq = Counter(w)
            so = sum(frq.values())
            total = fact[so]
            
            for i in frq.values():
                total = (total * inv_fact[i]) % MOD
            
            t = (t * total )% MOD
        return t
            
```
['Python3']