Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Regex solution in Clear category for [old] Double Substring by SaintDron
"use strict";
function doubleSubstring(line) {
for (let i = Math.floor(line.length/2); i > 0; i--) {
if (line.match(RegExp( `(.{${i}}).*?\\1` ))) return i;
}
return 0;
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(doubleSubstring('aaaa'), 2, "First")
assert.equal(doubleSubstring('abc'), 0, "Second")
assert.equal(doubleSubstring('aghtfghkofgh'), 3, "Third")
console.log('"Run" is good. How is "Check"?');
}
March 4, 2018