Tham khảo:
program bai1;
var S:string ;
j:integer;
n,k:byte;
i:char;
begin
k:=0;
write('nhap xau S');
read (S);
for i:= 'A' to 'Z' do
begin
n:=0;
for j:= 1 to length(S) do
if s[j]=i then
n:=n+1;
if n<> 0 then
k:=k+1;
end;
write ('so ki tu chu cai tieng anh in hoa khac nhau trong xau S=',k);
readln
end.