Problem:
Finding a Word

Write a program which reads a word W and a text T, and prints the number of word W which appears in text T

T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive.

Constraints

The length of W ≤ 10

W consists of lower case letters

The length of T in a line ≤ 1000

Input

In the first line, the word W is given. In the following lines, the text T is given separated by space characters and newlines.

"END_OF_TEXT" indicates the end of the text.

Output

Print the number of W in the text.

Sample Input

computer
Nurtures computer scientists and highly-skilled computer engineers
who will create and exploit "knowledge" for the new era.
Provides an outstanding computer environment.
END_OF_TEXT

Sample Output

3

Solution in C (judge verdict: Time Limit Exceeded)

#include <stdio.h>
#include <string.h>

#define SIZE_STRING			(10)
#define SIZE_SENTENCE		(1000)
#define SIZE_OF_ENT_TEXT	(11)

static void initialize_sentence_array(char *string, int size);
static void convert_uppercase_to_lowercase(char *string, int size);

int main(void)
{
	char string[SIZE_STRING];
	char sentence[SIZE_SENTENCE];
	char *const end_of_text = "END_OF_TEXT";
	int foundNumber;
	int i;
	int j;
	int k;

	foundNumber = 0;

	scanf("%s", string);

	while(0 != memcmp(sentence, end_of_text, SIZE_OF_ENT_TEXT)){
		initialize_sentence_array(sentence, SIZE_SENTENCE);
		scanf("%s", sentence);
		convert_uppercase_to_lowercase(sentence, SIZE_SENTENCE);
		convert_uppercase_to_lowercase(string, SIZE_STRING);
		for(i = 0; i < SIZE_SENTENCE; i++){
			if(sentence[i] == string[0]){
				k = 0;
				j = i;
				while(sentence[j++] == string[k++]){
					if('\0' == string[k]){
						foundNumber++;
					}
					if('\0' == sentence[j]){
						break;
					}
				}
			}
		}
	}

	printf("%d\n", foundNumber);

	return 0;
}

static void initialize_sentence_array(char *string, int size)
{
	int i;

	for(i = 0; i < size; i++){
		string[i] = 0;
	}
}

static void convert_uppercase_to_lowercase(char *string, int size)
{
	int i;

	for(i = 0; i < size; i++){
		if(65 <= string[i] && string[90] <= i){
			string[i] = string[i] + 32;
		}
	}
}