Words containing "the" substring
- Task
Using the dictionary unixdict.txt, search words containing "the" substring,
then display the found words (on this page).
The length of any word shown should have a length > 11.
- Metrics
- Counting
- Word frequency
- Letter frequency
- Jewels and stones
- Bioinformatics/base count
- Count occurrences of a substring
- Remove/replace
- XXXX redacted
- Remove vowels from a string
- Strip block comments
- Strip comments from a string
- Strip a set of characters from a string
- Strip whitespace from a string -- top and tail
- Strip control codes and extended characters from a string
- Anagrams/Derangements/shuffling
- Word wheel
- ABC problem
- Anagrams
- Anagrams/Deranged anagrams
- Permutations/Derangements
- Superpermutation minimisation
- Sattolo cycle
- Knuth shuffle
- Ordered words
- Textonyms (using a phone text pad)
- Find/Search/Determine
- ABC words
- Odd words
- Semordnilap
- Similar words
- String matching
- Alternade words
- Changeable words
- String comparison
- Extract file extension
- Levenshtein distance
- Palindrome detection
- Compare a list of strings
- Longest common prefix
- Longest common suffix
- Longest common substring
- Find common directory path
- Non-continuous subsequences
- Longest common subsequence
- Longest palindromic substrings
- Longest increasing subsequence
- Words containing "the" substring
- Determine if a string is numeric
- Determine if a string is collapsible
- Determine if a string is squeezable
- Determine if a string has all unique characters
- Determine if a string has all the same characters
- Find words which odd letters are consonants and even letters are vowels or vice_versa
- Formatting
- String case
- Align columns
- Literals/String
- Repeat a string
- Brace expansion
- Brace expansion using ranges
- Reverse a string
- Phrase reversals
- Comma quibbling
- Special characters
- String concatenation
- Substring/Top and tail
- Commatizing numbers
- Reverse words in a string
- Suffixation of decimal numbers
- Numerical and alphabetical suffixes
- Abbreviations, easy
- Abbreviations, simple
- Abbreviations, automatic
- Song lyrics/poems/Mad Libs/phrases
- 99 Bottles of Beer
- The Twelve Days of Christmas
- The Old lady swallowed a fly
- The Name Game (a song)
- Magic 8-ball
- Mad Libs
- Tokenize
- Word break problem
- Tokenize a string
- Tokenize a string with escaping
- Split a character string based on change of character
- Sequences
Contents
ALGOL 68[edit]
# find 12 character (or more) words that have "the" in them #
IF FILE input file;
STRING file name = "unixdict.txt";
open( input file, file name, stand in channel ) /= 0
THEN
# failed to open the file #
print( ( "Unable to open """ + file name + """", newline ) )
ELSE
# file opened OK #
BOOL at eof := FALSE;
# set the EOF handler for the file #
on logical file end( input file, ( REF FILE f )BOOL:
BEGIN
# note that we reached EOF on the #
# latest read #
at eof := TRUE;
# return TRUE so processing can continue #
TRUE
END
);
INT the count := 0;
WHILE STRING word;
get( input file, ( word, newline ) );
NOT at eof
DO
IF INT w len = ( UPB word + 1 ) - LWB word;
w len > 11
THEN
BOOL found the := FALSE;
FOR w pos FROM LWB word TO UPB word - 2 WHILE NOT found the DO
IF word[ w pos : w pos + 2 ] = "the" THEN
found the := TRUE;
the count +:= 1;
print( ( word, " " ) );
IF the count MOD 6 = 0
THEN print( ( newline ) )
ELSE FROM w len + 1 TO 18 DO print( ( " " ) ) OD
FI
FI
OD
FI
OD;
print( ( newline, "found ", whole( the count, 0 ), " ""the"" words", newline ) );
close( input file )
FI
- Output:
authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping found 32 "the" words
AppleScript[edit]
AppleScripters can tackle this task in a variety of ways. The example handlers below are listed in order of increasing speed but all complete the task in under 0.2 seconds on my current machine. They all take a file specifier, search string, and minimum length as parameters and return identical results for the same input.
Using just the core language — 'words':
on wordsContaining(textfile, searchText, minLength)
script o
property wordList : missing value
property output : {}
end script
-- Extract the text's 'words' and return any that meet both the search text and minimum length requirements.
set o's wordList to words of (read (textfile as alias) as «class utf8»)
repeat with thisWord in o's wordList
if ((thisWord contains searchText) and (thisWord's length ≥ minLength)) then
set end of o's output to thisWord's contents
end if
end repeat
return o's output
end wordsContaining
Using just the core language — 'text items':
on wordsContaining(textFile, searchText, minLength)
script o
property textItems : missing value
property output : {}
end script
-- Extract the text's search-text-delimited sections.
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to searchText
set o's textItems to text items of (read (textFile as alias) as «class utf8»)
set AppleScript's text item delimiters to astid
-- Reconstitute any words containing the search text from the stubs at the section ends and
-- the search text itself, returning any results which meet the minimum length requirement.
set thisSection to beginning of o's textItems
set sectionHasWords to ((count thisSection's words) > 0)
considering white space
repeat with i from 2 to (count o's textItems)
set foundWord to searchText
if (sectionHasWords) then
set thisStub to thisSection's last word
if (thisSection ends with thisStub) then set foundWord to thisStub & foundWord
end if
set thisSection to item i of o's textItems
set sectionHasWords to ((count thisSection's words) > 0)
if (sectionHasWords) then
set thisStub to thisSection's first word
if (thisSection begins with thisStub) then set foundWord to foundWord & thisStub
end if
if (foundWord's length ≥ minLength) then set end of o's output to foundWord
end repeat
end considering
return o's output
end wordsContaining
Using a shell script:
on wordsContaining(textFile, searchText, minLength)
-- Set up and execute a shell script which uses grep to find words containing the search text
-- (matching AppleScript's current case-sensitivity setting) and awk to pass those which
-- satisfy the minimum length requirement.
if ("A" = "a") then
set part1 to "grep -io "
else
set part1 to "grep -o "
end if
set shellCode to part1 & quoted form of ("\\b\\w*" & searchText & "\\w*\\b") & ¬
(" <" & quoted form of textFile's POSIX path) & ¬
(" | awk " & quoted form of ("// && length($0) >= " & minLength))
return paragraphs of (do shell script shellCode)
end wordsContaining
Using Foundation methods (AppleScriptObjC):
use AppleScript version "2.4" -- OS X 10.10 (Yosemite) or later
use framework "Foundation"
use scripting additions
on wordsContaining(textFile, searchText, minLength)
set theText to current application's class "NSMutableString"'s ¬
stringWithContentsOfFile:(textFile's POSIX path) usedEncoding:(missing value) |error|:(missing value)
-- Replace every run of non AppleScript 'word' characters with a linefeed.
tell theText to replaceOccurrencesOfString:("(?:[\\W--[.'’]]|(?<!\\w)[.'’]|[.'’](?!\\w))++") withString:(linefeed) ¬
options:(current application's NSRegularExpressionSearch) range:({0, its |length|()})
-- Split the text at the linefeeds.
set theWords to theText's componentsSeparatedByString:(linefeed)
-- Filter the resulting array for strings which meet the search text and minimum length requirements,
-- matching AppleScript's current case-sensitivity setting. NSString lengths are measured in 16-bit
-- code units so use regex to check the lengths in characters.
if ("A" = "a") then
set filterTemplate to "((self CONTAINS[c] %@) && (self MATCHES %@))"
else
set filterTemplate to "((self CONTAINS %@) && (self MATCHES %@))"
end if
set filter to current application's class "NSPredicate"'s ¬
predicateWithFormat_(filterTemplate, searchText, ".{" & minLength & ",}+")
return (theWords's filteredArrayUsingPredicate:(filter)) as list
end wordsContaining
Test code for the task with any of the above:
local textFile, output
set textFile to ((path to desktop as text) & "unixdict.txt") as «class furl»
-- considering case -- Uncomment this and the corresponding 'end' line for case-sensitive searches.
set output to wordsContaining(textFile, "the", 12)
-- end considering
return {count output, output}
- Output:
{32, {"authenticate", "chemotherapy", "chrysanthemum", "clothesbrush", "clotheshorse", "eratosthenes", "featherbedding", "featherbrain", "featherweight", "gaithersburg", "hydrothermal", "lighthearted", "mathematician", "neurasthenic", "nevertheless", "northeastern", "northernmost", "otherworldly", "parasympathetic", "physiotherapist", "physiotherapy", "psychotherapeutic", "psychotherapist", "psychotherapy", "radiotherapy", "southeastern", "southernmost", "theoretician", "weatherbeaten", "weatherproof", "weatherstrip", "weatherstripping"}}
AWK[edit]
The following is an awk one-liner entered at a Posix shell.
/Code$ awk '/the/ && length($1) > 11' unixdict.txt
authenticate
chemotherapy
chrysanthemum
clothesbrush
clotheshorse
eratosthenes
featherbedding
featherbrain
featherweight
gaithersburg
hydrothermal
lighthearted
mathematician
neurasthenic
nevertheless
northeastern
northernmost
otherworldly
parasympathetic
physiotherapist
physiotherapy
psychotherapeutic
psychotherapist
psychotherapy
radiotherapy
southeastern
southernmost
theoretician
weatherbeaten
weatherproof
weatherstrip
weatherstripping
/Code$
Factor[edit]
USING: io io.encodings.ascii io.files kernel math sequences ;
"unixdict.txt" ascii file-lines
[ length 11 > ] filter
[ "the" swap subseq? ] filter
[ print ] each
- Output:
authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping
FreeBASIC[edit]
Reuses some code from Odd words#FreeBASIC
#define NULL 0
type node
word as string*32 'enough space to store any word in the dictionary
nxt as node ptr
end type
function addword( tail as node ptr, word as string ) as node ptr
'allocates memory for a new node, links the previous tail to it,
'and returns the address of the new node
dim as node ptr newnode = allocate(sizeof(node))
tail->nxt = newnode
newnode->nxt = NULL
newnode->word = word
return newnode
end function
function length( word as string ) as uinteger
'necessary replacement for the built-in len function, which in this
'case would always return 32
for i as uinteger = 1 to 32
if asc(mid(word,i,1)) = 0 then return i-1
next i
return 999
end function
dim as string word
dim as node ptr tail = allocate( sizeof(node) )
dim as node ptr head = tail, curr = head, currj
tail->nxt = NULL
tail->word = "XXXXHEADER"
open "unixdict.txt" for input as #1
while true
line input #1, word
if word = "" then exit while
if length(word)>11 then tail = addword( tail, word )
wend
close #1
dim as string tempword
while curr->nxt <> NULL
for i as uinteger = 1 to length(curr->word)-3
if mid(curr->word,i,3) = "the" then print curr->word
next i
curr = curr->nxt
wend
- Output:
authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping
Go[edit]
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"strings"
"unicode/utf8"
)
func main() {
wordList := "unixdict.txt"
b, err := ioutil.ReadFile(wordList)
if err != nil {
log.Fatal("Error reading file")
}
bwords := bytes.Fields(b)
var words []string
for _, bword := range bwords {
s := string(bword)
if utf8.RuneCountInString(s) > 11 {
words = append(words, s)
}
}
count := 0
fmt.Println("Words containing 'the' having a length > 11 in", wordList, "\b:")
for _, word := range words {
if strings.Contains(word, "the") {
count++
fmt.Printf("%2d: %s\n", count, word)
}
}
}
- Output:
Words containing 'the' having a length > 11 in unixdict.txt: 1: authenticate 2: chemotherapy 3: chrysanthemum 4: clothesbrush 5: clotheshorse 6: eratosthenes 7: featherbedding 8: featherbrain 9: featherweight 10: gaithersburg 11: hydrothermal 12: lighthearted 13: mathematician 14: neurasthenic 15: nevertheless 16: northeastern 17: northernmost 18: otherworldly 19: parasympathetic 20: physiotherapist 21: physiotherapy 22: psychotherapeutic 23: psychotherapist 24: psychotherapy 25: radiotherapy 26: southeastern 27: southernmost 28: theoretician 29: weatherbeaten 30: weatherproof 31: weatherstrip 32: weatherstripping
Julia[edit]
See Alternade_words for the foreachword function.
containsthe(w, d) = occursin("the", w) ? w : ""
foreachword("unixdict.txt", containsthe, minlen = 12)
- Output:
Word source: unixdict.txt authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympatheticphysiotherapistphysiotherapy psychotherapeuticpsychotherapistpsychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping
min[edit]
"unixdict.txt" fread "\n" split
(length 11 >) filter
("the" indexof -1 !=) filter
(puts!) foreach
- Output:
authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping
Perl[edit]
Perl one-liner entered from a Posix shell:
/Code$ perl -n -e '/(\w*the\w*)/ && length($1)>11 && print' unixdict.txt
authenticate
chemotherapy
chrysanthemum
clothesbrush
clotheshorse
eratosthenes
featherbedding
featherbrain
featherweight
gaithersburg
hydrothermal
lighthearted
mathematician
neurasthenic
nevertheless
northeastern
northernmost
otherworldly
parasympathetic
physiotherapist
physiotherapy
psychotherapeutic
psychotherapist
psychotherapy
radiotherapy
southeastern
southernmost
theoretician
weatherbeaten
weatherproof
weatherstrip
weatherstripping
/Code$
Phix[edit]
function the(string word) return length(word)>11 and match("the",word) end function
sequence words = filter(get_text("demo/unixdict.txt",GT_LF_STRIPPED),the)
printf(1,"found %d 'the' words:\n%s\n",{length(words),join(shorten(words,"",3),", ")})
- Output:
found 32 'the' words: authenticate, chemotherapy, chrysanthemum, ..., weatherproof, weatherstrip, weatherstripping
Plain English[edit]
To run:
Start up.
Put "c:\unixdict.txt" into a path.
Read the path into a buffer.
Slap a rider on the buffer.
Loop.
Move the rider (text file rules).
Subtract 1 from the rider's token's last. \newline
Put the rider's token into a word string.
If the word is blank, break.
If the word's length is less than 12, repeat.
If "the" is in the word, write the word on the console.
Repeat.
Wait for the escape key.
Shut down.
- Output:
authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping
Python[edit]
Entered from a Posix shell:
/Code$ python -c 'import sys
> for line in sys.stdin:
> if "the" in line and len(line.strip()) > 11:
> print(line.rstrip())
> ' < unixdict.txt
authenticate
chemotherapy
chrysanthemum
clothesbrush
clotheshorse
eratosthenes
featherbedding
featherbrain
featherweight
gaithersburg
hydrothermal
lighthearted
mathematician
neurasthenic
nevertheless
northeastern
northernmost
otherworldly
parasympathetic
physiotherapist
physiotherapy
psychotherapeutic
psychotherapist
psychotherapy
radiotherapy
southeastern
southernmost
theoretician
weatherbeaten
weatherproof
weatherstrip
weatherstripping
/Code$
Quackery[edit]
Uses a finite state machine to search efficiently for a substring. (The fsm to search for "the" is built only once, during compilation.) Presented as a dialogue in the Quackery shell (REPL).
/O> [ $ 'sundry/fsm.qky' loadfile ] now!
... [ dup
... [ $ 'the' buildfsm ] constant
... usefsm over found ] is contains-"the"
... []
... $ 'unixdict.txt' sharefile drop
... nest$ witheach
... [ dup size 12 < iff drop done
... contains-"the" iff [ nested join ]
... else drop ]
... 60 wrap$ cr
...
authenticate chemotherapy chrysanthemum clothesbrush
clotheshorse eratosthenes featherbedding featherbrain
featherweight gaithersburg hydrothermal lighthearted
mathematician neurasthenic nevertheless northeastern
northernmost otherworldly parasympathetic physiotherapist
physiotherapy psychotherapeutic psychotherapist
psychotherapy radiotherapy southeastern southernmost
theoretician weatherbeaten weatherproof weatherstrip
weatherstripping
Stack empty.
Raku[edit]
A trivial modification of the ABC words task.
put 'unixdict.txt'.IO.words».fc.grep({ (.chars > 11) && (.contains: 'the') })\
.&{"{+$_} words:\n " ~ .batch(8)».fmt('%-17s').join: "\n "};
- Output:
32 words: authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping
REXX[edit]
This REXX version doesn't care what order the words in the dictionary are in, nor does it care what
case (lower/upper/mixed) the words are in, the search for the substring the is caseless.
It also allows the substring to be specified on the command line (CL) as well as the dictionary file identifier.
Programming note: If the minimum length is negative, it indicates to find the words (but not display them), and
only the display the count of found words.
/*REXX program finds words that contain the substring "the" (within an identified dict.)*/
parse arg $ minL iFID . /*obtain optional arguments from the CL*/
if $=='' | $=="," then $= 'the' /*Not specified? Then use the default.*/
if minL=='' | minL=="," then minL= 12 /* " " " " " " */
if iFID=='' | iFID=="," then iFID='unixdict.txt' /* " " " " " " */
tell= minL>0; minL= abs(minL) /*use absolute value of minimum length.*/
@.= /*default value of any dictionary word.*/
do #=1 while lines(iFID)\==0 /*read each word in the file (word=X).*/
@.#= strip( linein( iFID) ) /*pick off a word from the input line. */
end /*#*/
#= # - 1 /*adjust word count because of DO loop.*/
$u= $; upper $u /*obtain an uppercase version of $. */
say copies('─', 25) # "words in the dictionary file: " iFID
say
finds= 0 /*count of the substring found in dict.*/
do j=1 for #; z= @.j; upper z /*process all the words that were found*/
if length(z)<minL then iterate /*Is word too short? Yes, then skip.*/
if pos($u, z)==0 then iterate /*Found the substring? No, " " */
finds= finds + 1 /*bump count of substring words found. */
if tell then say right(left(@.j, 20), 25) /*Show it? Indent original word.*/
end /*j*/
/*stick a fork in it, we're all done. */
say copies('─', 25) finds " words (with a min. length of" ,
minL') that contains the substring: ' $
- output when using the default inputs:
───────────────────────── 25104 words in the dictionary file: unixdict.txt authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping ───────────────────────── 32 words (with a min. length of 12) that contain the substring: the
- output when using the input of: , -3
───────────────────────── 25105 words in the dictionary file: unixdict.txt ───────────────────────── 287 words (with a min. length of 3) that contains the substring: the
Ring[edit]
cStr = read("unixdict.txt")
wordList = str2list(cStr)
num = 0
the = "the"
see "working..." + nl
ln = len(wordList)
for n = ln to 1 step -1
if len(wordList[n]) < 12
del(wordList,n)
ok
next
see "Words containing "the" substring:" + nl
for n = 1 to len(wordList)
ind = substr(wordList[n],the)
if ind > 0
num = num +1
see "" + num + ". " + wordList[n] + nl
ok
next
see "done..." + nl
Output:
working... Founded "the" words are: 1. authenticate 2. chemotherapy 3. chrysanthemum 4. clothesbrush 5. clotheshorse 6. eratosthenes 7. featherbedding 8. featherbrain 9. featherweight 10. gaithersburg 11. hydrothermal 12. lighthearted 13. mathematician 14. neurasthenic 15. nevertheless 16. northeastern 17. northernmost 18. otherworldly 19. parasympathetic 20. physiotherapist 21. physiotherapy 22. psychotherapeutic 23. psychotherapist 24. psychotherapy 25. radiotherapy 26. southeastern 27. southernmost 28. theoretician 29. weatherbeaten 30. weatherproof 31. weatherstrip 32. weatherstripping done...
Smalltalk[edit]
'unixdict.txt' asFilename contents
select:[:word | (word size > 11) and:[word includesString:'the']]
thenDo:#transcribeCR
if counting per word is required (which is overkill here, as there are no duplicates in the file), keep them in a bag:
bagOfWords := Bag new.
'unixdict.txt' asFilename contents
select:[:word | (word size > 11) and:[word includesString:'the']]
thenDo:[:word | bagOfWords add:word. word transcribeCR].
bagOfWords transcribeCR.
bagOfWords size transcribeCR
Note: #transcribeCR is a method in Object which says: "Transcript showCR:self".
Variant (as script file). Save to file: "filter.st":
#! /usr/bin/env stx --script
[Stdin atEnd] whileFalse:[
|word|
((word := Stdin nextLine) size > 11
and:[word includesString:'the']
) ifTrue:[
Stdout nextPutLine: word
]
]
Execute with:
chmod +x filter.st
./filter.st < unixdict.txt
The output from the above counting snippet:
- Output:
authenticate chemotherapy chrysanthemum ... weatherproof weatherstrip weatherstripping Bag(chrysanthemum(*1) hydrothermal(*1) nevertheless(*1) chemotherapy(*1) eratosthenes(*1) mathematician(*1) ... theoretician(*1) weatherbeaten(*1) weatherstripping(*1)) 32
Wren[edit]
import "io" for File
import "/fmt" for Fmt
var wordList = "unixdict.txt" // local copy
var words = File.read(wordList).trimEnd().split("\n").where { |w| w.count > 11 }.toList
var count = 0
System.print("Words containing 'the' having a length > 11 in %(wordList):")
for (word in words) {
if (word.contains("the")) {
count = count + 1
Fmt.print("$2d: $s", count, word)
}
}
- Output:
Words containing 'the' having a length > 11 in unixdict.txt: 1: authenticate 2: chemotherapy 3: chrysanthemum 4: clothesbrush 5: clotheshorse 6: eratosthenes 7: featherbedding 8: featherbrain 9: featherweight 10: gaithersburg 11: hydrothermal 12: lighthearted 13: mathematician 14: neurasthenic 15: nevertheless 16: northeastern 17: northernmost 18: otherworldly 19: parasympathetic 20: physiotherapist 21: physiotherapy 22: psychotherapeutic 23: psychotherapist 24: psychotherapy 25: radiotherapy 26: southeastern 27: southernmost 28: theoretician 29: weatherbeaten 30: weatherproof 31: weatherstrip 32: weatherstripping
XPL0[edit]
string 0; \use zero-terminated strings
int I, Ch, Len;
char Word(100); \(longest word in unixdict.txt is 22 chars)
def LF=$0A, CR=$0D, EOF=$1A;
[FSet(FOpen("unixdict.txt", 0), ^I); \open dictionary and set it to device 3
OpenI(3);
repeat I:= 0;
loop [repeat Ch:= ChIn(3) until Ch # CR; \remove possible CR
if Ch=LF or Ch=EOF then quit;
Word(I):= Ch;
I:= I+1;
];
Word(I):= 0; \terminate string
Len:= I;
if Len >= 12 then
for I:= 0 to Len-3 do \scan for "the" (assume lowercase)
if Word(I)=^t & Word(I+1)=^h & Word(I+2)=^e then
[Text(0, Word); CrLf(0)];
until Ch = EOF;
]
- Output:
authenticate chemotherapy chrysanthemum clothesbrush clotheshorse eratosthenes featherbedding featherbrain featherweight gaithersburg hydrothermal lighthearted mathematician neurasthenic nevertheless northeastern northernmost otherworldly parasympathetic physiotherapist physiotherapy psychotherapeutic psychotherapist psychotherapy radiotherapy southeastern southernmost theoretician weatherbeaten weatherproof weatherstrip weatherstripping