with Text_Io;
procedure Count_Lines_Text_Io_Solution (Filename : String) is

    Input : Text_Io.File_Type;

    Line : String (1 .. 100);
    Last : Natural;

    Filename_Template : String (1 .. 30) := (others => ' ');

    Total_Lines : Natural := 0;
    Blank_Lines : Natural := 0;
    Comment_Lines : Natural := 0;
    Number_Of_Semicolons : Natural := 0;

    package Natural_Io is new Text_Io.Integer_Io (Natural);

    function Remove_Blanks (Line : String) return String is
        Last_Non_Blank : Natural;
    begin
        for I in reverse Line'First .. Line'Last loop
            if Line (I) /= ' ' then
                Last_Non_Blank := I;
                exit;
            end if;
        end loop;
        for I in Line'First .. Line'Last loop
            if Line (I) /= ' ' then
                return Line (I .. Last_Non_Blank);
            end if;
        end loop;
        return "";
    end Remove_Blanks;
begin
    Text_Io.Open (Input, Text_Io.In_File, Filename);

    while not Text_Io.End_Of_File (Input) loop
        Text_Io.Get_Line (Input, Line, Last);

        declare
            Stripped_Line : constant String := Remove_Blanks (Line (1 .. Last));
        begin
            Total_Lines := Total_Lines + 1;

            if Stripped_Line = "" then
                Blank_Lines := Blank_Lines + 1;
            elsif Stripped_Line (Stripped_Line'First) = '-' and then
                  Stripped_Line (Stripped_Line'First + 1) = '-' then

                Comment_Lines := Comment_Lines + 1;
            elsif Stripped_Line (Stripped_Line'Last) = ';' then
                Number_Of_Semicolons := Number_Of_Semicolons + 1;
            end if;

        end;
    end loop;

    Text_Io.Close (Input);

    Natural_Io.Put (Blank_Lines, 8);
    Natural_Io.Put (Comment_Lines, 16);
    Natural_Io.Put (Number_Of_Semicolons, 14);
    Natural_Io.Put (Total_Lines, 11);


    Text_Io.Put ("    ");
    Text_Io.Put_Line (Filename);

end Count_Lines_Text_Io_Solution;