Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Letter-frequency/Seed7/letter-frequency.seed7
Normal file
22
Task/Letter-frequency/Seed7/letter-frequency.seed7
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const type: charHash is hash [char] integer;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var charHash: numberOfChars is charHash.EMPTY_HASH;
|
||||
var char: ch is ' ';
|
||||
begin
|
||||
ch := getc(IN);
|
||||
while ch <> EOF do
|
||||
if ch in numberOfChars then
|
||||
incr(numberOfChars[ch]);
|
||||
else
|
||||
numberOfChars @:= [ch] 1;
|
||||
end if;
|
||||
ch := getc(IN);
|
||||
end while;
|
||||
for ch range sort(keys(numberOfChars)) do
|
||||
writeln(ch <& " " <& numberOfChars[ch]);
|
||||
end for;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue