with Ada.Integer_Text_IO; use  Ada.Integer_Text_IO;
with Ada.Text_IO;         use  Ada.Text_IO;

procedure dis is

   MaxWordLength: Constant Integer := 100;

   type Word is record
      letters: String(1 .. MaxWordLength);
      length: Natural := 0;
   end record;

   MaxArraySize: Constant Integer := 100;

   type WordArray is array (1 .. MaxArraySize) of Word;

   type WordList is record
       theWords: WordArray;
       count: Natural := 0;
   end record;

   procedure put(w: Word) is
   begin
      put(w.letters(1 .. w.length));
   end put;

   procedure putWords(myWords: WordList) is
   begin
       for i in 1 .. myWords.count loop
           put(myWords.theWords(i));
           new_line;
       end loop;
   end putWords;
  
   function "="(left, right: Word) return Boolean is
   begin
           -- return left.length = right.length and then
           return left.letters(1..left.length) = right.letters(1..right.length);
   end "=";

   procedure addWord(aWord: Word; myWords: in out WordList) is

        found: Boolean := false;
        w: Word;

   begin
       -- find out if word is in array
       for i in 1 .. myWords.count loop
           w := myWords.theWords(i);
           if w = aWord then
               found := true;
           end if;
       end loop;

       -- if not in array, add it
       if not found then 
           myWords.count := myWords.count + 1;
           myWords.theWords(myWords.count) := aWord;
       end if;
   end addWord ;
  
   w1: Word;

   theWords: WordList;

begin
    while not end_of_file loop
        get_line(w1.letters, w1.length);

        addWord(w1, theWords);
    end loop;

    putWords(theWords);
end dis;