[Java] multiply Anagrams of every strings
Code\njava\nclass Solution {\n    long mod = (long) 1e9+7;\n    public int countAnagrams(String s) {\n        int n = s.length();\n        long[] fact = new lon
# Code\n```java\nclass Solution {\n    long mod = (long) 1e9+7;\n    public int countAnagrams(String s) {\n        int n = s.length();\n        long[] fact = new long[n+1];\n        fact[0] = 1L;\n        for(int i=1;i<=n;i++){\n            fact[i] = fact[i-1]*i%mod;\n        }\n        String[] str = s.split(" ");\n        long ans = 1;\n        for(String t:str){\n            int[] ch = new int[26];\n            for(char c:t.toCharArray()){\n                ch[c-\'a\']++;\n            }\n            long cur = 1;\n            for(int a:ch){\n                cur = cur *fact[a]%mod;\n            }\n            long cur = fact[t.length()] * binpow(cur,mod-2) % mod;\n            ans = ans * cur % mod;\n        }\n        return (int) ans;\n    }\n    long binpow(long a, long b) {\n        if (b == 0)\n            return 1;\n        long res = binpow(a, b / 2);\n        res = res * res % mod;\n        if (b % 2==1)\n            return res * a % mod;\n        else\n            return  res;\n    }\n}\n```
['Java']