import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final String END_OF_TEXT = "END_OF_TEXT", WORD = sc.nextLine();
		int count = 0;
		while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		}
		sc.close();
		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);
		final String END_OF_TEXT = "END_OF_TEXT", WORD = sc.nextLine();
		int count = 0;
		while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		}
		sc.close();
		System.out.println(count);	
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final String END_OF_TEXT = "END_OF_TEXT", WORD = sc.nextLine();
		int count = 0;
		while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		}
		sc.close();
		System.out.println(count);	
	} main {
		Scanner sc = new Scanner(System.in);
		final String END_OF_TEXT = "END_OF_TEXT", WORD = sc.nextLine();
		int count = 0;
		while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		}
		sc.close();
		System.out.println(count);	
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String END_OF_TEXT = "END_OF_TEXT" END_OF_TEXT "END_OF_TEXT" WORD = sc.nextLine(); WORD sc.nextLine() sc.nextLine sc int count = 0; count 0 while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		} sc.hasNext() sc.hasNext sc {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		} String text = sc.next(); text sc.next() sc.next sc if (text.equals(END_OF_TEXT)) break; text.equals(END_OF_TEXT) text.equals text END_OF_TEXT break; if (text.equalsIgnoreCase(WORD)) count++; text.equalsIgnoreCase(WORD) text.equalsIgnoreCase text WORD count++ count sc.close() sc.close sc 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);
		final String END_OF_TEXT = "END_OF_TEXT", WORD = sc.nextLine();
		int count = 0;
		while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		}
		sc.close();
		System.out.println(count);	
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final String END_OF_TEXT = "END_OF_TEXT", WORD = sc.nextLine();
		int count = 0;
		while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		}
		sc.close();
		System.out.println(count);	
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final String END_OF_TEXT = "END_OF_TEXT", WORD = sc.nextLine();
		int count = 0;
		while (sc.hasNext()) {
			String text = sc.next();
			if (text.equals(END_OF_TEXT)) break;
			if (text.equalsIgnoreCase(WORD)) count++;
		}
		sc.close();
		System.out.println(count);	
	}
}