Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Striped Words by Moff
function isStriped(w) {
const vowels = 'AEIOUY';
const digits = '0123456789';
w = w.toUpperCase();
let flag = vowels.indexOf(w[0]) === -1;
for (let c of w) {
if (digits.indexOf(c) > -1 || flag === vowels.indexOf(c) > -1)
return false;
flag = !flag;
}
return true;
}
function stripedWords(text) {
let result = 0;
let match = null;
let re = /(\w\w+)/g;
while (match = re.exec(text)) {
if (isStriped(match[1]))
result++;
}
return result;
}
July 12, 2017