Find words whose first and last three letters are equal: Difference between revisions
Find words whose first and last three letters are equal (view source)
Revision as of 23:53, 7 April 2021
, 3 years agoAda version
(Added Forth solution) |
(Ada version) |
||
Line 10:
{{Template:Strings}}
<br><br>
=={{header|Ada}}==
<lang Ada>with Ada.Text_Io;
with Ada.Strings.Fixed;
procedure Find_Three_Equals is
use Ada.Text_Io;
use Ada.Strings.Fixed;
Filename : constant String := "unixdict.txt";
File : File_Type;
begin
Open (File, In_File, Filename);
while not End_Of_File (File) loop
declare
Word : constant String := Get_Line (File);
First : String renames Head (Word, 3);
Last : String renames Tail (Word, 3);
begin
if First = Last and Word'Length > 5 then
Put_Line (Word);
end if;
end;
end loop;
Close (File);
end Find_Three_Equals;</lang>
=={{header|ALGOL 68}}==
|