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

public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				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 s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		}
		System.out.println(count);
	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		}
		System.out.println(count);
	} main {
		Scanner s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		}
		System.out.println(count);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int count = 0; count 0 String findWord = s.nextLine(); findWord s.nextLine() s.nextLine s List<String> result = new ArrayList<>(); result new ArrayList<>() while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		} true {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		} String word = s.next(); word s.next() s.next s if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			} word.equals("END_OF_TEXT") word.equals word "END_OF_TEXT" {
				break;
			} break; {
				result.add(word);
			} result.add(word) result.add result word for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		} int i = 0; int i = 0; i 0 i< result.size() i result.size() result.size result i++ i++ i {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		} {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		} if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			} result.get(i).equalsIgnoreCase(findWord) result.get(i).equalsIgnoreCase result.get(i) result.get result i findWord {
				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 s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		}
		System.out.println(count);
	}

} public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				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 s = new Scanner(System.in);
		int count = 0;
		String findWord = s.nextLine();
		List<String> result = new ArrayList<>();
		while (true) {
			String word = s.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}

		}
		for(int i = 0; i< result.size();i++) {
			if(result.get(i).equalsIgnoreCase(findWord)) {
				count++;
			}
			
		}
		System.out.println(count);
	}

}