var a:string;
b:char;
i,sum:integer;
begin
readln(a,b);
for i:=1 to length(a) do begin
if pos(b,a)<>0 then begin
sum:=sum+1;
delete(a,1,pos(b,a));
end;
writeln(sum);
end.
var a:string;
b:char;
i,sum:integer;
begin
readln(a,b);
for i:=1 to length(a) do begin
if pos(b,a)<>0 then begin
sum:=sum+1;
delete(a,1,pos(b,a));
end;
end;
writeln(sum);
end.