import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		String W, T = "";
		int count = 0;

		Scanner sc = new Scanner(System.in);
		W = sc.next();
		while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		}
		System.out.println(count);
		sc.close();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		String W, T = "";
		int count = 0;

		Scanner sc = new Scanner(System.in);
		W = sc.next();
		while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		}
		System.out.println(count);
		sc.close();
	}
} Main public static void main(String args[]) {
		String W, T = "";
		int count = 0;

		Scanner sc = new Scanner(System.in);
		W = sc.next();
		while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		}
		System.out.println(count);
		sc.close();
	} main {
		String W, T = "";
		int count = 0;

		Scanner sc = new Scanner(System.in);
		W = sc.next();
		while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		}
		System.out.println(count);
		sc.close();
	} String W W T = ""; T "" int count = 0; count 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) W = sc.next() W sc.next() sc.next sc while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		} T.compareTo("END_OF_TEXT") != 0 T.compareTo("END_OF_TEXT") T.compareTo T "END_OF_TEXT" 0 {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		} T = sc.next() T sc.next() sc.next sc if (W.compareToIgnoreCase(T) == 0) {
				++count;
			} W.compareToIgnoreCase(T) == 0 W.compareToIgnoreCase(T) W.compareToIgnoreCase W T 0 {
				++count;
			} ++count count System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String args[] args public class Main {
	public static void main(String args[]) {
		String W, T = "";
		int count = 0;

		Scanner sc = new Scanner(System.in);
		W = sc.next();
		while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		}
		System.out.println(count);
		sc.close();
	}
} public class Main {
	public static void main(String args[]) {
		String W, T = "";
		int count = 0;

		Scanner sc = new Scanner(System.in);
		W = sc.next();
		while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		}
		System.out.println(count);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		String W, T = "";
		int count = 0;

		Scanner sc = new Scanner(System.in);
		W = sc.next();
		while (T.compareTo("END_OF_TEXT") != 0) {
			T = sc.next();
			if (W.compareToIgnoreCase(T) == 0) {
				++count;
			}
		}
		System.out.println(count);
		sc.close();
	}
}

