import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	} main {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 String key = sc.next(); key sc.next() sc.next sc while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		} true {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		} String word = sc.next(); word sc.next() sc.next sc if (word.equals("END_OF_TEXT")) {
				break;
			} word.equals("END_OF_TEXT") word.equals word "END_OF_TEXT" {
				break;
			} break; word = word.toLowerCase() word word.toLowerCase() word.toLowerCase word if (key.equals(word)) {
				count++;
			} key.equals(word) key.equals key word {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		String key = sc.next();
		while (true) {
			String word = sc.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			}

			word = word.toLowerCase();
			if (key.equals(word)) {
				count++;
			}
		}

		System.out.println(count);

	}
}
