program task_d;
var count_sym, i, counter: integer;
n,n_1, p,r:string;
begin
readln(p);
readln(r);
count_sym := 1;
counter  := 1;
for i:=1 to length(r) do
begin
     n := Copy(r, i, count_sym);
     n_1 :=  Copy(r, i, count_sym+1);
     if (Pos(n, p)<>0 ) and (Pos(n_1, p)=0) then
        begin
        count_sym := 1;
        counter:=counter+1;
        end
     else count_sym := count_sym+1;
 
end;
 
writeln(counter);
end.