ASCII key and Fermat's Little Theorem
Intuition\n Describe your first thoughts on how to solve this problem. \nASCII key and Fermat\'s Little Theorem\n# Approach\n Describe your approach to solving 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nASCII key and Fermat\'s Little Theorem\n# Approach\n<!-- Describe your approach to solving the problem. -->\nASCII key and Fermat\'s Little Theorem\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n```golang []\nconst MOD = 1000000007\n\n// Function to compute factorial % MOD\nfunc factorial(n int) int {\n\tresult := 1\n\tfor i := 2; i <= n; i++ {\n\t\tresult = (result * i) % MOD\n\t}\n\treturn result\n}\n\n// Function to compute (base^exp) % mod\nfunc powerMod(base, exp, mod int) int {\n\tresult := 1\n\tbase = base % mod\n\tfor exp > 0 {\n\t\tif exp%2 == 1 {\n\t\t\tresult = (result * base) % mod\n\t\t}\n\t\texp = exp >> 1\n\t\tbase = (base * base) % mod\n\t}\n\treturn result\n}\n\n// Function to compute modular inverse using Fermat\'s Little Theorem\nfunc modInverse(a, mod int) int {\n\treturn powerMod(a, mod-2, mod)\n}\n\nfunc countAnagrams(s string) int {\n\tcount := 1\n\tfor _, w := range strings.Split(s, " ") {\n\t\tfreq := [26]int{}\n\t\twordFact := factorial(len(w))\n\t\tfor _, c := range w {\n\t\t\tfreq[c-\'a\']++\n\t\t}\n\t\tfor _, f := range freq {\n\t\t\tif f > 1 {\n\t\t\t\twordFact = (wordFact * modInverse(factorial(f), MOD)) % MOD\n\t\t\t}\n\t\t}\n\t\tcount = (count * wordFact) % MOD\n\t}\n\treturn count\n}\n```
['Go']