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);
		String w = s.nextLine();
		int count = 0;
		List<String> t = new ArrayList<>();
		
		while(true) {
			String test = s.next();
			if(test.equals("END_OF_TEXT")) {
				break;
			}else {
				t.add(test);
			}
		}
		
		for(int j =0;j<t.size();j++) {
			if(t.get(j).equalsIgnoreCase(w)) {
				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);
		String w = s.nextLine();
		int count = 0;
		List<String> t = new ArrayList<>();
		
		while(true) {
			String test = s.next();
			if(test.equals("END_OF_TEXT")) {
				break;
			}else {
				t.add(test);
			}
		}
		
		for(int j =0;j<t.size();j++) {
			if(t.get(j).equalsIgnoreCase(w)) {
				count++;
			}
		}

		System.out.println(count);
	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String w = s.nextLine();
		int count = 0;
		List<String> t = new ArrayList<>();
		
		while(true) {
			String test = s.next();
			if(test.equals("END_OF_TEXT")) {
				break;
			}else {
				t.add(test);
			}
		}
		
		for(int j =0;j<t.size();j++) {
			if(t.get(j).equalsIgnoreCase(w)) {
				count++;
			}
		}

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

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

		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String w = s.nextLine();
		int count = 0;
		List<String> t = new ArrayList<>();
		
		while(true) {
			String test = s.next();
			if(test.equals("END_OF_TEXT")) {
				break;
			}else {
				t.add(test);
			}
		}
		
		for(int j =0;j<t.size();j++) {
			if(t.get(j).equalsIgnoreCase(w)) {
				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);
		String w = s.nextLine();
		int count = 0;
		List<String> t = new ArrayList<>();
		
		while(true) {
			String test = s.next();
			if(test.equals("END_OF_TEXT")) {
				break;
			}else {
				t.add(test);
			}
		}
		
		for(int j =0;j<t.size();j++) {
			if(t.get(j).equalsIgnoreCase(w)) {
				count++;
			}
		}

		System.out.println(count);
	}

}