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