RosettaCodeData/Task/Letter-frequency/Pascal/letter-frequency.pas

15 lines
299 B
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

program letterFrequency(input, output);
var
chart: array[char] of 0..maxInt value [otherwise 0];
c: char;
begin
{ parameter-less EOF checks for EOF(input) }
while not EOF do
begin
read(c);
chart[c] := chart[c] + 1
end;
{ now, chart[someLetter] gives you the letters frequency }
end.