FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 2605,3 "name": "count_anagrams",4 "difficulty": "Hard",5 "link": "https://leetcode.com/problems/count-anagrams/",6 "date": "1670630400000",7 "task_description": "You are given a string `s` containing one or more words. Every consecutive pair of words is separated by a single space `' '`. A string `t` is an **anagram** of string `s` if the `ith` word of `t` is a **permutation** of the `ith` word of `s`. For example, `\"acb dfe\"` is an anagram of `\"abc def\"`, but `\"def cab\"` and `\"adc bef\"` are not. Return _the number of **distinct anagrams** of _`s`. Since the answer may be very large, return it **modulo** `109 + 7`. **Example 1:** ``` **Input:** s = \"too hot\" **Output:** 18 **Explanation:** Some of the anagrams of the given string are \"too hot\", \"oot hot\", \"oto toh\", \"too toh\", and \"too oht\". ``` **Example 2:** ``` **Input:** s = \"aa\" **Output:** 1 **Explanation:** There is only one anagram possible for the given string. ``` **Constraints:** `1 <= s.length <= 105` `s` consists of lowercase English letters and spaces `' '`. There is single space between consecutive words.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "s = \"too hot\"",12 "output": "18 "13 },14 {15 "label": "Example 2",16 "input": "s = \"aa\"",17 "output": "1 "18 }19 ],20 "private_test_cases": [21 {22 "input": "exwwd h g gwjah dkenzm lsefdbx",23 "output": 12735981824 },25 {26 "input": "xiadu hhjwznshpu vgwwdci jetkdx bjda wygzeaybnjpitadeums zbvtbxbqoiincarawwfpcjipcdhkoxwiyilextnjuhyckdmswktsgalblbfyvmmkdbqtpxjfi",27 "output": 47638924528 },29 {30 "input": "kapz myr gcax",31 "output": 345632 },33 {34 "input": "tqyk bwkylasc oybtknjyoodhelqcculospnzpzeibo",35 "output": 94488638236 },37 {38 "input": "dipsap eocmc",39 "output": 2160040 },41 {42 "input": "mn xshpnx dn b dlzk xixdqmca p t kcmfefqrfdoirwbjvvup a",43 "output": 10957987244 },45 {46 "input": "vy pmqfigu vg lbkloix xn yamzxseeprrpp jrpijwnhynr hjvuyuefqtrxdczknkwfsn iwliazsyrmwrflizgula zbabmlpqkaduustmuqjtahrfeqeihbtzpbiuquxmvfght",47 "output": 41708886448 },49 {50 "input": "ltuj hqylb vid hfgeluu jysc xvxj szdcnmcadicay j ibrqlonyqwexulunbpvxlhzl",51 "output": 38300689752 },53 {54 "input": "kzmnek hsxodpqun yuctdeurewrddtnzptxkevedjeypbgbjx qjgxtkxbqwgalvccxaxeeumzhieebwzvwpsibuvuzhosegoioz",55 "output": 76951001156 },57 {58 "input": "kz sxkqe fqy rmzafbkn urws scenuqlwsgh tavvftekhlguvs cgspkvfgdepxfvcmgnqbhoicn xnivooeorwtejhdjujaz",59 "output": 80714115760 }61 ],62 "haskell_template": "countAnagrams :: String -> Int\ncountAnagrams s ",63 "ocaml_template": "let countAnagrams (s: string) : int = ",64 "scala_template": "def countAnagrams(s: String): Int = { \n \n}",65 "java_template": "public static int countAnagrams(String s) {\n\n}",66 "python_template": "class Solution(object):\n def countAnagrams(self, s):\n \"\"\"\n :type s: str\n :rtype: int\n \"\"\"\n "67}