#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBXT1JEX1NJWkUgPSAxMDsKY29uc3QgaW50IFRFWFRfU0laRSA9IDEwMDA7CmNvbnN0IGludCBDQVNFX0RJRiA9ICdhJyAtICdBJzsKCmJvb2wgaXNTbWFsTGV0dGVyKGNoYXIgYykgewoJcmV0dXJuIGMgPj0gJ2EnICYmIGMgPD0gJ3onOwp9Cgp2b2lkIGNhcHNMb2NrKGNoYXIgd29yZFtdLCBjb25zdCBpbnQgU0laRSkgewoJZm9yIChpbnQgaSA9IDA7IGkgPCBTSVpFOyArK2kpIHsKCQlpZiAoaXNTbWFsTGV0dGVyKHdvcmRbaV0pKSB7CgkJCXdvcmRbaV0gPSBjaGFyKHdvcmRbaV0gLSBDQVNFX0RJRik7CgkJfQoJfQp9CgppbnQgbWFpbigpIHsKCWNoYXIgd29yZFtXT1JEX1NJWkUgKyAgMV07CgljaW4uZ2V0bGluZSh3b3JkLCBXT1JEX1NJWkUgKyAxKTsKCW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