uses crt;
var a,b:string;
i,n,d,d1:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
write('Nhap xau b:'); readln(b);
if a[length(a)]=b[1] then writeln('Ki tu cuoi cua xau a trung voi ki tu dau cua xau b')
else writeln('Ki tu cuoi cua xau a khong trung voi ki tu dau cua xau b');
dem:=0;
while pos(b,a)>0 do
begin
inc(dem);
delete(a,pos(b,a),length(b));
end;
writeln('Xau b xuat hien ',dem,' lan trong xau a');
readln;
end.