import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String character = scanner.nextLine();
		List<String> list = new ArrayList<String>();
		String str;
		int count = 0;
		while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		}
		for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		}
		System.out.println(count);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String character = scanner.nextLine();
		List<String> list = new ArrayList<String>();
		String str;
		int count = 0;
		while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		}
		for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String character = scanner.nextLine();
		List<String> list = new ArrayList<String>();
		String str;
		int count = 0;
		while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		}
		for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		}
		System.out.println(count);
	} main {
		Scanner scanner = new Scanner(System.in);
		String character = scanner.nextLine();
		List<String> list = new ArrayList<String>();
		String str;
		int count = 0;
		while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		}
		for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		}
		System.out.println(count);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String character = scanner.nextLine(); character scanner.nextLine() scanner.nextLine scanner List<String> list = new ArrayList<String>(); list new ArrayList<String>() String str; str int count = 0; count 0 while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		} true {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		} str = scanner.next() str scanner.next() scanner.next scanner if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			} str .equals("END_OF_TEXT") str .equals str "END_OF_TEXT" {
				break;
			} break; {
				list.add(str);				
			} list.add(str) list.add list str for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		} int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		} {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		} if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			} character.equalsIgnoreCase(list.get(i)) character.equalsIgnoreCase character list.get(i) list.get list i {
				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 scanner = new Scanner(System.in);
		String character = scanner.nextLine();
		List<String> list = new ArrayList<String>();
		String str;
		int count = 0;
		while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		}
		for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		}
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String character = scanner.nextLine();
		List<String> list = new ArrayList<String>();
		String str;
		int count = 0;
		while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		}
		for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		}
		System.out.println(count);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String character = scanner.nextLine();
		List<String> list = new ArrayList<String>();
		String str;
		int count = 0;
		while (true) {
			str = scanner.next();			
			if(str .equals("END_OF_TEXT")) {
				break;
			}else {
				list.add(str);				
			}
		}
		for(int i = 0; i < list.size(); i++) {
			if(character.equalsIgnoreCase(list.get(i))) {
				count ++;
			}
		}
		System.out.println(count);
	}
}