RosettaCodeData/Task/Letter-frequency/BCPL/letter-frequency.bcpl

23 lines
426 B
Plaintext

get "libhdr"
let start() be
$( let count = vec 255
let file = findinput("unixdict.txt")
for i = 0 to 255 do i!count := 0
selectinput(file)
$( let ch = rdch()
if ch = endstreamch then break
ch!count := ch!count + 1
$) repeat
for i = 'A' to 'Z' do
$( let n = i!count + (i|32)!count
unless n = 0 do
writef("%C%C: %I5*N", i, i|32, n)
$)
endread()
$)