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

public class Main{
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);

		int number = 0;

		String Word = stdin.nextLine();

		List<String> result = new ArrayList<>();

		while (true) {
			String word = stdin.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(Word)) {
            	number++;
            }          

    }
    System.out.println(number);

}

	} 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 stdin = new Scanner(System.in);

		int number = 0;

		String Word = stdin.nextLine();

		List<String> result = new ArrayList<>();

		while (true) {
			String word = stdin.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(Word)) {
            	number++;
            }          

    }
    System.out.println(number);

}

	} Main public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);

		int number = 0;

		String Word = stdin.nextLine();

		List<String> result = new ArrayList<>();

		while (true) {
			String word = stdin.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(Word)) {
            	number++;
            }          

    }
    System.out.println(number);

} main {
		Scanner stdin = new Scanner(System.in);

		int number = 0;

		String Word = stdin.nextLine();

		List<String> result = new ArrayList<>();

		while (true) {
			String word = stdin.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(Word)) {
            	number++;
            }          

    }
    System.out.println(number);

} Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) int number = 0; number 0 String Word = stdin.nextLine(); Word stdin.nextLine() stdin.nextLine stdin List<String> result = new ArrayList<>(); result new ArrayList<>() while (true) {
			String word = stdin.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}
		} true {
			String word = stdin.next();
			if (word.equals("END_OF_TEXT")) {
				break;
			} else {
				result.add(word);
			}
		} String word = stdin.next(); word stdin.next() stdin.next stdin 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(Word)) {
            	number++;
            }          

    } 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(Word)) {
            	number++;
            }          

    } {
            if(result.get(i).equalsIgnoreCase(Word)) {
            	number++;
            }          

    } if(result.get(i).equalsIgnoreCase(Word)) {
            	number++;
            } result.get(i).equalsIgnoreCase(Word) result.get(i).equalsIgnoreCase result.get(i) result.get result i Word {
            	number++;
            } number++ number System.out.println(number) System.out.println System.out System System.out number String[] args args public class Main{
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);

		int number = 0;

		String Word = stdin.nextLine();

		List<String> result = new ArrayList<>();

		while (true) {
			String word = stdin.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(Word)) {
            	number++;
            }          

    }
    System.out.println(number);

}

	} public class Main{
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);

		int number = 0;

		String Word = stdin.nextLine();

		List<String> result = new ArrayList<>();

		while (true) {
			String word = stdin.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(Word)) {
            	number++;
            }          

    }
    System.out.println(number);

}

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

public class Main{
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);

		int number = 0;

		String Word = stdin.nextLine();

		List<String> result = new ArrayList<>();

		while (true) {
			String word = stdin.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(Word)) {
            	number++;
            }          

    }
    System.out.println(number);

}

	}