JAVA Solve
\n# Code\n\nclass Solution {\n    private static final int MOD = 1000000007;\n    public int countAnagrams(String s) {\n        long res=1;\n        String stri
\n# Code\n```\nclass Solution {\n    private static final int MOD = 1000000007;\n    public int countAnagrams(String s) {\n        long res=1;\n        String stringList [] = s.split(" ");\n        for(int i=0 ; i<stringList.length; i++){\n            long x = countChar(stringList[i]);\n            long y = p(stringList[i].length());\n            res *= (y*pow(x,MOD-2))%MOD;\n            res %=MOD;\n        }\n        return (int)res;\n    }\n    public  long p(long x){\n        long temp = 1;\n        for(int i=1 ; i<=x; i++) {\n            temp *= i;\n            temp %= (MOD);\n        }\n        return temp;\n    }\n    public long countChar(String s){\n        long sum = 1;\n        int arr[] = new int[26];\n        for(int i=0 ; i<s.length(); i++){\n            arr[s.charAt(i) - \'a\']++;\n        }\n        for(int i=0; i<arr.length; i++){\n            if(arr[i] != 0) {\n               sum *= p(arr[i]);\n               sum %= MOD;\n            }\n        }\n        return sum;\n    }\n   public  long  pow(long a,long n) {\n        long res = 1;\n        while(n>0) {\n            if(n%2 == 1) {\n                res = (res * a) % MOD;\n                n--;\n            }\n            else {\n                a = (a * a) % MOD;\n                n = n / 2;\n            }\n        }\n        return res;\n    }\n}\n```
['Java']