Question: Counting Characters in String

Hi I'm trying to write a proc to takes a character and a string as inputs and as output tells you how many times the character shows up in the string.
I don't know what is wrong with the code


local counts,C,i,L:

for C from "a" to "z" do
counts[C]:= 0:
end do:
for i from 1 to L do
if C >= "a" and C <= "z" then
counts[C] := counts[C] + 1
end if;
end do:
Please Wait...