Simple Python "in 2 lines" solution using map and distinct calculations
Description\n1e9 + 7 and 10**9 + 7 in Python are different (StackOverflow: 67438654)\n\n# Code\nPython\nclass Solution:\n    def distinctAnagram(self, s: str) -
# Description\n`1e9 + 7` and `10**9 + 7` in Python are different (StackOverflow: 67438654)\n\n# Code\n```Python\nclass Solution:\n    def distinctAnagram(self, s: str) -> int:\n        return math.factorial(len(s))//math.prod(map(lambda x: math.factorial(x), [s.count(i) for i in set(s)]))\n\n    def countAnagrams(self, s: str) -> int:\n        return int(math.prod(map(lambda x: self.distinctAnagram(x), s.split()))%(10**9 + 7))\n```
['Python3']