
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String W = scn.nextLine();
		int count = 0;
		final String LAST_DATA = "END_OF_TEXT";
		while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		}
		System.out.println(count);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String W = scn.nextLine();
		int count = 0;
		final String LAST_DATA = "END_OF_TEXT";
		while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String W = scn.nextLine();
		int count = 0;
		final String LAST_DATA = "END_OF_TEXT";
		while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		}
		System.out.println(count);
	} main {
		Scanner scn = new Scanner(System.in);
		String W = scn.nextLine();
		int count = 0;
		final String LAST_DATA = "END_OF_TEXT";
		while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		}
		System.out.println(count);
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String W = scn.nextLine(); W scn.nextLine() scn.nextLine scn int count = 0; count 0 final String LAST_DATA = "END_OF_TEXT"; LAST_DATA "END_OF_TEXT" while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		} scn.hasNextLine() scn.hasNextLine scn {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		} String T = scn.next(); T scn.next() scn.next scn if (T.equals(LAST_DATA)) {
				break;
			} T.equals(LAST_DATA) T.equals T LAST_DATA {
				break;
			} break; W = W.toLowerCase() W W.toLowerCase() W.toLowerCase W T = T.toLowerCase() T T.toLowerCase() T.toLowerCase T if (T.equals(W)) {
				count++;
			} T.equals(W) T.equals T W {
				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 scn = new Scanner(System.in);
		String W = scn.nextLine();
		int count = 0;
		final String LAST_DATA = "END_OF_TEXT";
		while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		}
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String W = scn.nextLine();
		int count = 0;
		final String LAST_DATA = "END_OF_TEXT";
		while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		}
		System.out.println(count);
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String W = scn.nextLine();
		int count = 0;
		final String LAST_DATA = "END_OF_TEXT";
		while (scn.hasNextLine()) {
			String T = scn.next();
			if (T.equals(LAST_DATA)) {
				break;
			}
			W = W.toLowerCase();
			T = T.toLowerCase();
			if (T.equals(W)) {
				count++;
			}
		}
		System.out.println(count);
	}
}

