All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General > Word Problems
Smart Trams (Posted on 2012-04-26) Difficulty: 4 of 5
This is a variation of Elite Etile.

Consider all possible valid English words having at least 3 letters and at most 13 letters that satisfy the following conditions:
  • Each word ends with a letter that immediately follows the letter that the word begins with. (For example, if a word begins with c it must end in d), and:
  • Reversing the letters we obtain another valid English word, and:
  • None of the words can be proper nouns, acronyms or abbreviations, and:
  • None of the words can be hyphenated like A-bomb, X-ray etc.
What is the longest word that satisfies all the given conditions? What are the respective first word and the last word appearing alphabetically? Does there exist any valid English word having more than 13 letters that satisfies all the conditions?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution (spoilers) | Comment 1 of 8

reknits, arb, swot, no.

List of 40 found by program, with their reverses:

arb  bra
cod  doc
deke  eked
flog  golf
keel  leek
larum  mural
loom  mool
man  nam
mon  nom
muton  notum
raps  spar
rats  star
rebus  suber
recaps  spacer
redes  seder
redips  spider
rees  seer
reknits  stinker
repins  sniper
repots  stoper
res  ser
retros  sorter
sat  tas
secret  terces
sit  tis
sleet  teels
slit  tils
smart  trams
snit  tins
snoot  toons
snot  tons
spat  taps
spirt  trips
spit  tips
spot  tops
sprat  tarps
stat  tats
stet  tets
swat  taws
swot  tows

OPEN "\words\words.txt" FOR INPUT AS #1
OPEN "elitetil.txt" FOR OUTPUT AS #2
 LINE INPUT #1, w$
 IF LEN(w$) >= 3 THEN
   IF ASC(LEFT$(w$, 1)) = ASC(RIGHT$(w$, 1)) - 1 THEN
     rv$ = ""
     FOR i = 1 TO LEN(w$)
       rv$ = MID$(w$, i, 1) + rv$
     IF isWord(rv$) THEN
         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
PRINT ct, 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
  CLOSE 10

It's a minor variation on the program for Elite Etile.

  Posted by Charlie on 2012-04-26 12:39:23
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information