import java.util.Scanner;

//20180510
//06

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

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    }
} Main public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    } main {
		Scanner scanner = new Scanner(System.in);

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String search = scanner.nextLine(); search scanner.nextLine() scanner.nextLine scanner String end = "END_OF_TEXT"; end "END_OF_TEXT" int count = 0; count 0 while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		} scanner.hasNextLine() scanner.hasNextLine scanner {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		} String string = scanner.next(); string scanner.next() scanner.next scanner if(string.contains(end)) {
				break;
			} string.contains(end) string.contains string end {
				break;
			} break; if(string.equalsIgnoreCase(search)) {
				count++;
			} string.equalsIgnoreCase(search) string.equalsIgnoreCase string search {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    }
} public class Main {
    public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    }
} Main
import java.util.Scanner;

//20180510
//06

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

		String search = scanner.nextLine();
		String end = "END_OF_TEXT";
		int count = 0;

		while (scanner.hasNextLine()) {
			String string = scanner.next();
			if(string.contains(end)) {
				break;
			}
			if(string.equalsIgnoreCase(search)) {
				count++;
			}
		}
		System.out.println(count);
		scanner.close();
    }
}
