This is a variation of Abarcadraba
Consider all possible valid English words having at least 4 letters and at most 13 letters that satisfies the following conditions:
- Each word begins and ends with the same letter, and:
- Reversing the letters we obtain another valid English word, and:
- None of the words can be palindromes, and:
- None of the words can be plurals, proper nouns or abbreviations, and:
- None of the words can be hyphenated like A-bomb, X-ray etc.
What are the respective shortest word and the longest word that satisfy all the given conditions? Does there exist any valid English word having more than 13 letters that satisfies all the conditions?
Word pairs like snips and spins have been left in as they may be singular verbs rather than plural nouns. I may have been inconsistent as to judging whether a given pair included both words that could be judged as singular verbs as opposed to plural nouns, and so the reverse order might not appear if I judged differently in the two cases.
The longest was redrawer rewarder, in either order.
The shortest were several, bolded above, that had the minimum length, 4.
None exceeded 13 in length.
Etile doesn't seem to be in my word list.
DECLARE FUNCTION isWord& (wrd$)
OPEN "\words\words.txt" FOR INPUT AS #1
OPEN "elitetil.txt" FOR OUTPUT AS #2
shortest = 99
LINE INPUT #1, w$
IF LEN(w$) >= 3 THEN
IF LEFT$(w$, 1) = RIGHT$(w$, 1) THEN
rv$ = ""
FOR i = 1 TO LEN(w$)
rv$ = MID$(w$, i, 1) + rv$
IF rv$ <> w$ THEN
IF isWord(rv$) THEN
IF LEN(w$) < shortest THEN shortest = LEN(w$)
IF LEN(w$) > longest THEN longest = LEN(w$)
PRINT w$; " "; rv$
ct = ct + 1
IF ct MOD 44 = 0 THEN DO: LOOP UNTIL INKEY$ > "": PRINT
LOOP UNTIL EOF(1)
PRINT ct, shortest; longest
FUNCTION isWord (wrd$)
OPEN "\words\words" + LTRIM$(STR$(LEN(wrd$))) + ".txt" FOR BINARY AS #10
n = LEN(wrd$)
wrd1$ = SPACE$(n)
l = LOF(10) / n
low = 1: high = l
mid = INT((low + high) / 2)
GET #10, (mid - 1) * n + 1, wrd1$
IF wrd1$ = wrd$ THEN isWord = -1: CLOSE 10: EXIT FUNCTION
IF wrd1$ < wrd$ THEN low = mid + 1: ELSE high = mid - 1
LOOP UNTIL low > high
isWord = 0
Posted by Charlie
on 2012-01-23 15:21:03