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

        String t, p;
        p = scanner.next();
        int counter = 0;

        while(true){
            t = scanner.next();
            if(t.equals("END_OF_TEXT")) break;

            if(t.equalsIgnoreCase(p)){
                counter ++;
            }
        }
        System.out.println(counter);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        String t, p;
        p = scanner.next();
        int counter = 0;

        while(true){
            t = scanner.next();
            if(t.equals("END_OF_TEXT")) break;

            if(t.equalsIgnoreCase(p)){
                counter ++;
            }
        }
        System.out.println(counter);
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        String t, p;
        p = scanner.next();
        int counter = 0;

        while(true){
            t = scanner.next();
            if(t.equals("END_OF_TEXT")) break;

            if(t.equalsIgnoreCase(p)){
                counter ++;
            }
        }
        System.out.println(counter);
    } main {
        Scanner scanner = new Scanner(System.in);

        String t, p;
        p = scanner.next();
        int counter = 0;

        while(true){
            t = scanner.next();
            if(t.equals("END_OF_TEXT")) break;

            if(t.equalsIgnoreCase(p)){
                counter ++;
            }
        }
        System.out.println(counter);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String t t p; p p = scanner.next() p scanner.next() scanner.next scanner int counter = 0; counter 0 while(true){
            t = scanner.next();
            if(t.equals("END_OF_TEXT")) break;

            if(t.equalsIgnoreCase(p)){
                counter ++;
            }
        } true {
            t = scanner.next();
            if(t.equals("END_OF_TEXT")) break;

            if(t.equalsIgnoreCase(p)){
                counter ++;
            }
        } t = scanner.next() t scanner.next() scanner.next scanner if(t.equals("END_OF_TEXT")) break; t.equals("END_OF_TEXT") t.equals t "END_OF_TEXT" break; if(t.equalsIgnoreCase(p)){
                counter ++;
            } t.equalsIgnoreCase(p) t.equalsIgnoreCase t p {
                counter ++;
            } counter ++ counter System.out.println(counter) System.out.println System.out System System.out counter String[] args args
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        String t, p;
        p = scanner.next();
        int counter = 0;

        while(true){
            t = scanner.next();
            if(t.equals("END_OF_TEXT")) break;

            if(t.equalsIgnoreCase(p)){
                counter ++;
            }
        }
        System.out.println(counter);
    }
}
