during a boring telephone conference I typed this in notepad - so it is neither tested nor compiled, but the principle should work.
Code:
var different_letters(char* s)
{
var letterflag[256];
var count = 0;
var i,l;
l=str_len(s);
for (i=0;i<l;i++) {letterflag[i]=TRUE};
for (i=0;i<l;i++)
{
if (letterflag[(integer)(s[i])])
count++;
else
letterflag[(integer)(s[i])]=FALSE;
}
return (count);
}