[Javascript] modular multiplicative inverse
Using modular multiplicative inverse formula found on internet https://cp-algorithms.com/algebra/module-inverse.html\n\n\n/**\n * @param {string} s\n * @return 
Using modular multiplicative inverse formula found on internet https://cp-algorithms.com/algebra/module-inverse.html\n\n```\n/**\n * @param {string} s\n * @return {number}\n */\nvar countAnagrams = function (s) {\n  let result = 1n;\n  const MODULO = 1000000007n;\n\n  // precompute factorials\n  const facts = new Array(1e5 + 10).fill(1n);\n  for (let i = 1; i < facts.length; ++i) facts[i] = ((facts[i - 1] % MODULO) * (BigInt(i) % MODULO)) % MODULO;\n\n  for (const w of s.split(\' \')) {\n    const cnt = w.split(\'\').reduce((a, x) => (a.set(x, (a.get(x) || 0) + 1), a), new Map());\n    let divisor = [...cnt.values()].reduce((a, x) => (a * facts[x]) % MODULO, 1n);\n    let div_inv_mod = 1n;\n    let power = MODULO - 2n;\n    while (0n < power) {\n      if (power & 1n) div_inv_mod = (div_inv_mod * divisor) % MODULO;\n      divisor = (divisor * divisor) % MODULO;\n      power >>= 1n;\n    }\n    result = ((result * (facts[w.length] * div_inv_mod)) % MODULO) % MODULO;\n  }\n\n  return Number(result);\n};\n\n```
['JavaScript']