Brute Force Accepted || Formula
From basic math one can observe that answer is the product of the number of unique anagrams for each word in a sentence. So, we find number of anagrams of each 
From basic math one can observe that answer is the product of the number of unique anagrams for each word in a sentence. So, we find number of anagrams of each word in sentence and multiple it.\n**Formula of finding number of anagrams of word:**\n```\nFactorial(length of word)/(multiple Factorial(count of each character in word))\n```\n**Example:**\n```\ns="too hot"\nunique number of anagrams of "too" = Factorial(3)/(Factorial(1)*Factorial(2)) = 3\nunique number of anagrams of "hot" = Factorial(3)/(Factorial(1)*Factorial(1)*Factorial(1)) = 6\nanswer = 6*3 =18\n```\n\n**Code:**\n```\nclass Solution:\n    def countAnagrams(self, s: str) -> int:\n        s=list(s.split())\n        ans=1\n        for word in s:\n            length=len(word)\n            c=Counter(word)\n            temp=1\n            for i in c:\n                temp*=factorial(c[i])\n            ans*=(factorial(length)//temp)\n        return ans%(10**9+7)\n```\n\nYou can understand more about formula from [here](https://www.youtube.com/watch?v=ZL_vjZtnLSA)
['Python3']