import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		int i = 0;

		while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			}
		System.out.println(i);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		int i = 0;

		while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			}
		System.out.println(i);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		int i = 0;

		while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			}
		System.out.println(i);
	} main {
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		int i = 0;

		while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			}
		System.out.println(i);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String W = sc.next(); W sc.next() sc.next sc int i = 0; i 0 while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			} sc.hasNext() sc.hasNext sc {
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			} String str = sc.next(); str sc.next() sc.next sc if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			} str.equals("END_OF_TEXT") str.equals str "END_OF_TEXT" {
				break;
			} break; if(str.equalsIgnoreCase(W)){
				i++;
			} str.equalsIgnoreCase(W) str.equalsIgnoreCase str W {
				i++;
			} i++ i System.out.println(i) System.out.println System.out System System.out i String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		int i = 0;

		while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			}
		System.out.println(i);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		int i = 0;

		while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			}
		System.out.println(i);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		int i = 0;

		while(sc.hasNext()){
			String str = sc.next();

			if(str.equals("END_OF_TEXT")){
				break;
			}else if(str.equalsIgnoreCase(W)){
				i++;
			}
			}
		System.out.println(i);
	}
}

