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

Home > General > Word Problems
The Amazing Shrinking Word (Posted on 2003-08-19) Difficulty: 4 of 5
There is a common English word that is nine letters long.

Each time you remove a letter from it, it still remains an English word - from nine letters right down to a single letter.

What is the original word, and what are the words that it becomes after removing one letter at a time?

See The Solution Submitted by zineera    
Rating: 4.2857 (7 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: computer search-- the program | Comment 4 of 12 |
(In reply to computer search by Charlie)

DECLARE SUB subtlet (w$)
DECLARE FUNCTION isWord! (w$)
DIM SHARED hist$(10)

CLS
OPEN "bwords9.txt" FOR BINARY AS #1
OPEN "9lets.txt" FOR OUTPUT AS #3
w$ = SPACE$(9)

DO
  GET #1, , w$
  hist$(LEN(w$)) = w$
  subtlet w$
LOOP UNTIL EOF(1)

CLOSE

FUNCTION isWord (w$)
  n = LEN(w$)
  IF w$ = "i" THEN isWord = 1: EXIT FUNCTION
  w1$ = SPACE$(n)
  IF n > 2 THEN
   OPEN "bwords" + LTRIM$(STR$(n)) + ".txt" FOR BINARY AS #2
  ELSE
   OPEN "words" + LTRIM$(STR$(n)) + ".txt" FOR BINARY AS #2
  END IF
  l = LOF(2) / n
  low = 1: high = l
  DO
    mid = INT((low + high) / 2)
    GET #2, (mid - 1) * n + 1, w1$
    IF w1$ = w$ THEN isWord = 1: CLOSE 2: EXIT FUNCTION
    IF w1$ < w$ THEN low = mid + 1: ELSE high = mid - 1
  LOOP UNTIL low > high
  isWord = 0
  CLOSE 2
END FUNCTION

SUB subtlet (w$)
  FOR i = 1 TO LEN(w$) ' STEP LEN(w$) - 1
    w2$ = LEFT$(w$, i - 1) + MID$(w$, i + 1)
    IF isWord(w2$) THEN
      hist$(LEN(w2$)) = w2$
      IF LEN(w2$) = 1 THEN
       FOR j = 9 TO 1 STEP -1
        PRINT hist$(j); " ";
       NEXT
       PRINT
       FOR j = 9 TO 1 STEP -1
        PRINT #3, hist$(j); " ";
       NEXT
       PRINT #3,
      ELSE
       subtlet w2$
      END IF
    END IF
  NEXT
END SUB


  Posted by Charlie on 2003-08-19 09:05:00

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information