<pre>function charFrequency theChar,theString  put 0 into charCount  put first char of theChar into theChar  repeat with x = 1 to the length of theString    if char x of theString is theChar then add 1 to charCount  end repeat  return charCountend charFrequency</pre>