Kotlin simple solution
\nclass Solution {\n    val mod: Long = (1e9+7).toLong()\n\n    fun power(x: Long, y: Long): Long {\n        var x: Long = x\n        var y: Long = y\n        v
```\nclass Solution {\n    val mod: Long = (1e9+7).toLong()\n\n    fun power(x: Long, y: Long): Long {\n        var x: Long = x\n        var y: Long = y\n        var ans: Long = 1\n        x %= mod\n        while (y > 0) {\n            if (y and 1 == 1L) \n                ans = (ans * x) % mod\n            x = (x * x) % mod\n            y = y shr 1\n        }\n        return ans\n    }\n    \n    fun factorial(x: Long): Long{\n        var fac: Long = 1L\n        for(i in 1 until x+1)\n            fac = (fac * i) % mod\n        return fac\n    }\n\n    fun countAnagrams(s: String): Int {\n        var ans = 1L\n        s.split(\' \').forEach {\n            val counts = LongArray(26){0}\n            for(c in it) {\n                counts[c-\'a\']++\n            }\n            var fac: Long = factorial(it.length.toLong())\n            for(cnt in counts) {\n                if(cnt != 0L) {\n                    fac = (fac * power(factorial(cnt),mod-2))%mod\n                }\n            }\n            ans = (ans * fac) % mod\n        }\n        return ((ans + mod) % mod).toInt()\n    }\n}\n```
['Kotlin']