import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String key = in.next().toLowerCase();
        int count = 0;
        while(true) {
            String input = in.next();
            if(input.equals("END_OF_TEXT")) break;
            if(input.equalsIgnoreCase(key)) count++;
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String key = in.next().toLowerCase();
        int count = 0;
        while(true) {
            String input = in.next();
            if(input.equals("END_OF_TEXT")) break;
            if(input.equalsIgnoreCase(key)) count++;
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String key = in.next().toLowerCase();
        int count = 0;
        while(true) {
            String input = in.next();
            if(input.equals("END_OF_TEXT")) break;
            if(input.equalsIgnoreCase(key)) count++;
        }
        System.out.println(count);
    } main {
        Scanner in = new Scanner(System.in);
        String key = in.next().toLowerCase();
        int count = 0;
        while(true) {
            String input = in.next();
            if(input.equals("END_OF_TEXT")) break;
            if(input.equalsIgnoreCase(key)) count++;
        }
        System.out.println(count);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String key = in.next().toLowerCase(); key in.next().toLowerCase() in.next().toLowerCase in.next() in.next in int count = 0; count 0 while(true) {
            String input = in.next();
            if(input.equals("END_OF_TEXT")) break;
            if(input.equalsIgnoreCase(key)) count++;
        } true {
            String input = in.next();
            if(input.equals("END_OF_TEXT")) break;
            if(input.equalsIgnoreCase(key)) count++;
        } String input = in.next(); input in.next() in.next in if(input.equals("END_OF_TEXT")) break; input.equals("END_OF_TEXT") input.equals input "END_OF_TEXT" break; if(input.equalsIgnoreCase(key)) count++; input.equalsIgnoreCase(key) input.equalsIgnoreCase input key count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String key = in.next().toLowerCase();
        int count = 0;
        while(true) {
            String input = in.next();
            if(input.equals("END_OF_TEXT")) break;
            if(input.equalsIgnoreCase(key)) count++;
        }
        System.out.println(count);
    }
}