Beats 100% in time and memory
Intuition\n Describe your first thoughts on how to solve this problem. \nthis problem can be solved by using the basic concepts of permutation and combination \
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nthis problem can be solved by using the basic concepts of permutation and combination \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nwe will brreak the string in a list of word and return the product of all permutations of each words\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution(object):\n    def countAnagrams(self, s):\n        words = list(s.split(" "))\n        #return len(words)\n        ans = 1\n        for i in words:\n            ans = ans*self.perm(i)\n        return ans%(10**9 + 7)\n    def perm(self,word):\n        ct=[]\n        for i in set(word):\n            ct.append(word.count(i))\n        if max(ct)==sum(ct):\n            return 1\n        ans = self.fac(sum(ct))\n        for i in ct:\n            ans = ans/self.fac(i)\n        return ans \n        \n    def fac(self,n):\n        ans = 1\n        for i in range(1,n+1):\n            ans=ans*i \n        return ans \n```
['Python']