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

20 lines
348 B
Plaintext
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, stdErr);
var
chart: array[char] of integer;
c: char;
begin
for c := low(chart) to high(chart) do
begin
chart[c] := 0;
end;
// parameter-less EOF() checks for EOF(input)
while not EOF() do
begin
read(c);
inc(chart[c]);
end;
// now, chart[someLetter] gives you the letters frequency
end.