{"ScriptPreparationCode":"const s = \u0027b\u0027.repeat(22) \u002B \u00270\u0027.repeat(10);","TestCases":[{"Name":"regex","Code":"const s = \u0027bbbbbbbbbbbbbbbbbbbbbb0000000000\u0027;\r\n\r\nconst re = new RegExp(\u00270\u002B$\u0027);\r\nconst res = s.replace(\u0027re\u0027, \u0027\u0027);","IsDeferred":false},{"Name":"slice","Code":"const s = \u0027bbbbbbbbbbbbbbbbbbbbbb0000000000\u0027;\r\n\r\nconst idx = s.indexOf(0);\r\nconst res = s.slice(0, i);","IsDeferred":false},{"Name":"while loop","Code":"const s = \u0027bbbbbbbbbbbbbbbbbbbbbb0000000000\u0027;\r\n\r\nlet idx = s.length - 1;\r\n\r\nwhile (idx \u003E 0) {\r\n\tif (s[idx] === \u00270\u0027) {\r\n \tidx--;\r\n } else {\r\n \tbreak;\r\n }\r\n}\r\n\r\nconst res = s.slice(0, i \u002B 1);\r\n\t","IsDeferred":false},{"Name":"binary search","Code":"const s = \u0027bbbbbbbbbbbbbbbbbbbbbb0000000000\u0027;\r\n\r\nlet l = 0;\r\nlet r = s.length - 1;\r\nlet mid;\r\n\r\nwhile (l \u003C r) {\r\n mid = (l \u002B r) \u003E\u003E 1;\r\n if (s[mid] === \u00270\u0027) {\r\n r = mid;\r\n } else {\r\n l = mid \u002B 1;\r\n }\r\n}\r\n\r\nconst res = s.slice(0, r);\r\n\r\n","IsDeferred":false}]}