{"ScriptPreparationCode":"var wordsInNumbers1 = (str, arr) =\u003E {\r\n const uniqueSizes = []\r\n const subStrings = new Set()\r\n\r\n return arr.reduce((acc, s) =\u003E {\r\n if (uniqueSizes.indexOf(s.length) === -1) {\r\n for (let i = 0; i \u003C (str.length - s.length \u002B 1); i\u002B\u002B) {\r\n subStrings.add(str.substr(i, s.length))\r\n }\r\n uniqueSizes.push(s.length)\r\n }\r\n\r\n if (subStrings.has(\r\n s.split(\u0027\u0027).map(char =\u003E \u002722233344455566677778889999\u0027 [char.charCodeAt() - 97]).join(\u0027\u0027))) return [...acc, s]\r\n\r\n return acc\r\n }, [])\r\n}\r\n\r\nconst keyMap = {\r\n a: 2,\r\n b: 2,\r\n c: 2,\r\n d: 3,\r\n e: 3,\r\n f: 3,\r\n g: 4,\r\n h: 4,\r\n i: 4,\r\n j: 5,\r\n k: 5,\r\n l: 5,\r\n m: 6,\r\n n: 6,\r\n o: 6,\r\n p: 7,\r\n q: 7,\r\n r: 7,\r\n s: 7,\r\n t: 8,\r\n u: 8,\r\n v: 8,\r\n w: 9,\r\n x: 9,\r\n y: 9,\r\n z: 9,\r\n};\r\n\r\nconst wordToNumbers = (word) =\u003E {\r\n const letters = Array.from(word);\r\n\r\n return letters.reduce((numberWord, letter) =\u003E {\r\n const numberLetter = keyMap[letter];\r\n return \u0060${numberWord}${numberLetter}\u0060;\r\n }, \u0022\u0022);\r\n};\r\n\r\nvar wordsInNumbers2 = (str, arr) =\u003E {\r\n return arr.filter((word) =\u003E {\r\n const numberWord = wordToNumbers(word);\r\n const re = new RegExp(numberWord, \u0022i\u0022);\r\n return re.test(str);\r\n });\r\n};","TestCases":[{"Name":"wordsInNumbers1","Code":"wordsInNumbers1(\u0027223786597355927753757922849683\u0027, [\u0027curl\u0027, \u0027apple\u0027, \u0027frog\u0027, \u0027cat\u0027, \u0027cool\u0027, \u0027egg\u0027, \u0027bat\u0027, \u0027den\u0027])","IsDeferred":false},{"Name":"wordsInNumbers2","Code":"wordsInNumbers2(\u0027223786597355927753757922849683\u0027, [\u0027curl\u0027, \u0027apple\u0027, \u0027frog\u0027, \u0027cat\u0027, \u0027cool\u0027, \u0027egg\u0027, \u0027bat\u0027, \u0027den\u0027])","IsDeferred":false}]}