easy solution with modular inverse, stringstream
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    \nconst int MOD = 1e9+7;\nint modInverse(int a, int m) {\n    int m0 = m;\n    int y = 0, x = 1;\n\n    if (m == 1)\n        return 0;\n\n    while (a > 1) {\n        int q = a / m;\n        int t = m;\n\n        m = a % m;\n        a = t;\n        t = y;\n\n        y = x - q * y;\n        x = t;\n    }\n\n    if (x < 0)\n        x += m0;\n\n    return x;\n}\n\nint countAnagrams(string s) {\n    stringstream ss(s);\n    string temp;\n    long long ans = 1;\n    vector<int> fac(s.size()+10,1);\n    for (int i = 2; i <= s.size()+8; i++) {\n        fac[i] = (i * 1LL * fac[i - 1]) % MOD;\n    }\n\n    while (ss >> temp) {\n        int tem = fac[temp.size()];\n        map<char, int> mp;\n\n        for (int i = 0; i < temp.size(); i++) {\n            mp[temp[i]]++;\n        }\n\n        for (auto m : mp) {\n            int inverse = modInverse(fac[m.second], MOD);\n            tem = (tem * 1LL * inverse) % MOD;\n        }\n\n\n        ans = (ans *1LL* tem) % MOD;\n    }\n\n    return ans;\n}\n};\n```
['Hash Table']