{"ScriptPreparationCode":"function regex (s, c) {\r\n return (s.match(new RegExp(c, \u0022g\u0022)) || []).length;\r\n}\r\n\r\nfunction split (s, c) {\r\n return s.split(c).length - 1;\r\n}\r\n\r\nfunction indexOf1 (s, c) {\r\n var i = 0, count = 0;\r\n while ((i = s.indexOf(c, i)) \u003E= 0) {\r\n count\u002B\u002B;\r\n i\u002B\u002B;\r\n }\r\n return count;\r\n}\r\n\r\nfunction indexOf2 (s, c) {\r\n for (let i = -2, count = -1; i != -1; count\u002B\u002B, i = s.indexOf(c, i \u002B 1));\r\n}\r\n\r\nfunction singleChar (s, c) {\r\n for(let i = 0, count = 0, l = s.length; i \u003C l; count \u002B= \u002B(c === s[i\u002B\u002B]));\r\n}\r\n\r\nvar s = \u0022Maecenas sed lacus erat. Sed fringilla dui ac mollis condimentum. Suspendisse bibendum nulla eros, ut lobortis orci posuere quis. Nunc fringilla ut metus ultrices dictum. Nunc elementum feugiat leo. Ut fermentum, enim vel vehicula posuere, metus eros imperdiet risus, at elementum mauris urna et quam. Ut vehicula, velit at placerat ornare, nulla nisi finibus sapien, non elementum tellus purus in ex. Donec pharetra elit in rhoncus placerat. Sed volutpat eget justo ut dapibus. Mauris consectetur turpis ac euismod aliquam. Sed pellentesque pretium nunc, nec rhoncus leo euismod ut. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur gravida sed urna quis tempus. Nam aliquet tortor convallis libero mollis luctus.\u0022;\r\nvar c = \u0022a\u0022;","TestCases":[{"Name":"regex","Code":"window.result = regex(s, c);","IsDeferred":false},{"Name":"split","Code":"window.result = split(s, c);","IsDeferred":false},{"Name":"indexOf1","Code":"window.result = indexOf1(s, c);","IsDeferred":false},{"Name":"indexOf2","Code":"window.result = indexOf2(s, c);","IsDeferred":false},{"Name":"singleChar","Code":"window.result = singleChar(s, c);","IsDeferred":false}]}