câu 1 Uses Crt;
Var St:String;
dem: Array[‘A’..’Z’] Of Byte
; i:Byte;
ch:Char;
Begin Write(‘Nhap xau St: ‘);
Readln(St);
{Khởi tạo mảng} For ch:=’A’ To ‘Z’ Do dem[ch]:=0;
{Duyệt xâu} For i:=1 To Length(St) Do If Upcase(St[i]) IN [‘A’..’Z’] Then Inc(dem[Upcase(St[i])]);
{Liệt kê các ký tự ra màn hình} For ch:=’A’ To ‘Z’ Do If dem[ch]>0 Then Writeln(ch,’ : ’,dem[ch]);
Readln;
uses crt;
var st:string;
i,d,kt:integer;
ktu:char;
begin
clrscr;
write('Nhap xau:'); readln(st);
write('Nhap ki tu:'); readln(ktu);
d:=length(st);
kt:=0;
for i:=1 to d do
if ktu=st[i] then kt:=1;
if kt=0 then writeln(ktu,' khong co trong xau')
else writeln(ktu,' co trong xau');
readln;
end.