Words containing "the" substring: Difference between revisions

Added XPL0 example.
(Added XPL0 example.)
Line 766:
31: weatherstrip
32: weatherstripping
</pre>
 
=={{header|XPL0}}==
<lang XPL0>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;
]</lang>
 
{{out}}
<pre>
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
</pre>
772

edits