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?
blub bulb
bulb blub
edile elide
elide edile
perp prep
prep perp
redrawer rewarder
rewarder redrawer
sallets stellas
sleets steels
snips spins
snoops spoons
spans snaps
spoons snoops
spots stops
steels sleets
stops spots
stows swots
struts sturts
sturts struts
swots stows
tort trot
trot tort
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
CLS
shortest = 99
DO
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$
NEXT
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
END IF
END IF
END IF
END IF
LOOP UNTIL EOF(1)
CLOSE
PRINT ct, shortest; longest
DEFLNG A-Z
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
DO
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
CLOSE 10
END FUNCTION
|
Posted by Charlie
on 2012-01-23 15:21:03 |