Find words whose first and last three letters are equal: Difference between revisions

Added Forth solution
(Added Algol 68)
(Added Forth solution)
Line 185:
{{out}}
As above.
 
=={{header|Forth}}==
{{works with|Gforth}}
<lang forth>: first-last-three-equal { addr len -- ? }
len 5 <= if false exit then
addr 3 addr len 3 - + 3 compare 0= ;
 
256 constant max-line
 
: main
0 0 { count fd-in }
s" unixdict.txt" r/o open-file throw to fd-in
begin
here max-line fd-in read-line throw
while
here swap 2dup first-last-three-equal if
count 1+ to count
count 1 .r ." . " type cr
else
2drop
then
repeat
drop
fd-in close-file throw ;
 
main
bye</lang>
 
{{out}}
<pre>
1. antiperspirant
2. calendrical
3. einstein
4. hotshot
5. murmur
6. oshkosh
7. tartar
8. testes
</pre>
 
=={{header|FreeBASIC}}==
1,777

edits