RosettaCodeData/Task/Letter-frequency/Phix/letter-frequency.phix
2016-12-05 23:44:36 +01:00

17 lines
361 B
Text

sequence lc = repeat(0,#7E)
integer fn = open(command_line()[$],"rb"), ch
while 1 do
ch = getc(fn)
if ch=-1 then exit end if
if ch>=' ' and ch<#7F then
lc[ch] += 1
end if
end while
close(fn)
for i=' ' to #7E do
if lc[i]!=0 then
printf(1,"'%c': %d%s",{i,lc[i],iff(mod(i,32)=31?'\n':'\t')})
end if
end for
{} = wait_key()