#include <iostream>
#include <cstring>
using namespace std;

const int WORD_SIZE = 10;
const int TEXT_SIZE = 1000;
const int CASE_DIF = 'a' - 'A';

bool isSmalLetter(char c) {
	return c >= 'a' && c <= 'z';
}

void capsLock(char word[], const int SIZE) {
	for (int i = 0; i < SIZE; ++i) {
		if (isSmalLetter(word[i])) {
			word[i] = char(word[i] - CASE_DIF);
		}
	}
}

int main() {
	char word[WORD_SIZE +  1];
	cin.getline(word, WORD_SIZE + 1);
	const int WORD_LENGTH = int(strlen(word));
	capsLock(word, WORD_LENGTH);
	char line[TEXT_SIZE + 1];
	int count = 0;
	while (cin.getline(line, TEXT_SIZE + 1)) {
		char *p = strchr(line, word[0]);
		while (p != 0) {
			int start = 0;
			while (word[start] == line[int(p - line) + start] && start < WORD_LENGTH) {
				++start;
			}
			if (start == WORD_LENGTH) {
				++count;
			}
			p = strchr(p + 1, word[0]);
		}
	}
	cout << count;
	return 0;
}