import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		int count = 0;
		String W = scan.nextLine();
		if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		}

		System.out.println(count);
	}
} import java.io.BufferedInputStream; BufferedInputStream java.io import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		int count = 0;
		String W = scan.nextLine();
		if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		}

		System.out.println(count);
	}
} Main public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		int count = 0;
		String W = scan.nextLine();
		if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		}

		System.out.println(count);
	} main {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		int count = 0;
		String W = scan.nextLine();
		if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		}

		System.out.println(count);
	} @SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in)); scan new Scanner(new BufferedInputStream(System.in)) int count = 0; count 0 String W = scan.nextLine(); W scan.nextLine() scan.nextLine scan if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		} W.length() <= 10 W.length() W.length W 10 {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		} while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			} scan.hasNext() scan.hasNext scan {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			} String T = scan.nextLine(); T scan.nextLine() scan.nextLine scan if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				} "END_OF_TEXT".equals(T) "END_OF_TEXT".equals "END_OF_TEXT" T {
					break;
				} break; {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				} String[] in = T.split(" "); in T.split(" ") T.split T " " for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					} int i = 0; int i = 0; i 0 i < in.length i in.length in in.length i++ i++ i {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					} {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					} String str = in[i]; str in[i] in i if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						} str.length() <= 10 str.length() str.length str 10 {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						} if (W.equalsIgnoreCase(str)) {
								count++;
							} W.equalsIgnoreCase(str) W.equalsIgnoreCase W str {
								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) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		int count = 0;
		String W = scan.nextLine();
		if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		}

		System.out.println(count);
	}
} public class Main{

	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		int count = 0;
		String W = scan.nextLine();
		if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		}

		System.out.println(count);
	}
} Main
import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(new BufferedInputStream(System.in));
		int count = 0;
		String W = scan.nextLine();
		if (W.length() <= 10) {
			while (scan.hasNext()) {
				String T = scan.nextLine();
				if ("END_OF_TEXT".equals(T)) {
					break;
				} else {
					String[] in = T.split(" ");
					for (int i = 0; i < in.length; i++) {
						String str = in[i];
						if (str.length() <= 10) {
							if (W.equalsIgnoreCase(str)) {
								count++;
							}
						}
					}
				}
			}
		}

		System.out.println(count);
	}
}