What's the longest English word that doesn't contain the same two letters in a row more than once?
Good word : too
contains to
once and oo
once.
Good word : tot
contains to
once and ot
once.
Bad word : aardvark
contains most pairs once but ar
appears twice.
Handy JavaScript test function :
function test_word(w){
for(var l=[],i=1; i var p=w[i-1]+w[i];
if( l[p] ) return p;
l[p]=true;
}
return true;
}
To test your word read the link above then copy and paste the test function hit enter then use the command:
test_word('yourword');
It will return true
if it is good and the repeated characters otherwise.
You can also check the word in Excel by entering the word into the cell A1
and entering this formula elsewhere as an array formula using Ctrl+Shift+Enter: (It will return TRUE
if it is good and FALSE
if it is not.)
=MAX(LEN($A$1)-LEN(SUBSTITUTE(UPPER($A$1),MID(UPPER($A$1),ROW(OFFSET($A$1,0,0,LEN($A$1)-1)),2),"")))<=2
No comments:
Post a Comment