import std.stdio, std.string, std.conv;
import std.algorithm;

void main() {
	auto input = getStdin!(string[]);
	string needle = input[0];
	string haystack = input[1..$-1].join(" ");

	int count = 0;
	while(findSplitAfter(haystack, needle)[0] != "") {
		haystack = findSplitAfter(haystack, needle)[1];
		count++;
	}

	count.writeln;
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}