Unique characters: Difference between revisions
Content added Content deleted
(→{{header|Haskell}}: Preferred Data.Map.Strict methods to a list comprehension) |
(Ada version) |
||
Line 130: | Line 130: | ||
{{out}} |
{{out}} |
||
<pre>156bgstz</pre> |
<pre>156bgstz</pre> |
||
=={{header|Ada}}== |
|||
<lang Ada>with Ada.Text_Io; |
|||
procedure Unique_Characters is |
|||
List : array (Character) of Natural := (others => 0); |
|||
procedure Count (Item : String) is |
|||
begin |
|||
for C of Item loop |
|||
List (C) := List (C) + 1; |
|||
end loop; |
|||
end Count; |
|||
procedure Put_Only_Once is |
|||
use Ada.Text_Io; |
|||
begin |
|||
for C in List'Range loop |
|||
if List (C) = 1 then |
|||
Put (C); |
|||
Put (' '); |
|||
end if; |
|||
end loop; |
|||
New_Line; |
|||
end Put_Only_Once; |
|||
begin |
|||
Count ("133252abcdeeffd"); |
|||
Count ("a6789798st"); |
|||
Count ("yxcdfgxcyz"); |
|||
Put_Only_Once; |
|||
end Unique_Characters;</lang> |
|||
{{out}} |
|||
<pre>1 5 6 b g s t z</pre> |
|||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |