import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        String target = sc.next();
        String input = sc.next();

        while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        }

        System.out.println(cnt);

        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        String target = sc.next();
        String input = sc.next();

        while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        }

        System.out.println(cnt);

        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        String target = sc.next();
        String input = sc.next();

        while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        }

        System.out.println(cnt);

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        String target = sc.next();
        String input = sc.next();

        while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        }

        System.out.println(cnt);

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int cnt = 0; cnt 0 String target = sc.next(); target sc.next() sc.next sc String input = sc.next(); input sc.next() sc.next sc while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        } !input.equals("END_OF_TEXT") input.equals("END_OF_TEXT") input.equals input "END_OF_TEXT" {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        } if (input.equalsIgnoreCase(target)) cnt++; input.equalsIgnoreCase(target) input.equalsIgnoreCase input target cnt++ cnt input = sc.next() input sc.next() sc.next sc System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        String target = sc.next();
        String input = sc.next();

        while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        }

        System.out.println(cnt);

        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        String target = sc.next();
        String input = sc.next();

        while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        }

        System.out.println(cnt);

        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        String target = sc.next();
        String input = sc.next();

        while (!input.equals("END_OF_TEXT")) {
            if (input.equalsIgnoreCase(target)) cnt++;
            input = sc.next();
        }

        System.out.println(cnt);

        sc.close();
    }
}
