import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String w = sc.next();
        String w2 = w.toLowerCase();
        String t = "",t2="";
        while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        }
        System.out.println(count);
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String w = sc.next();
        String w2 = w.toLowerCase();
        String t = "",t2="";
        while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String w = sc.next();
        String w2 = w.toLowerCase();
        String t = "",t2="";
        while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String w = sc.next();
        String w2 = w.toLowerCase();
        String t = "",t2="";
        while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 String w = sc.next(); w sc.next() sc.next sc String w2 = w.toLowerCase(); w2 w.toLowerCase() w.toLowerCase w String t = "" t "" t2=""; t2 "" while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        } true {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        } t = sc.next() t sc.next() sc.next sc t2 = t.toLowerCase() t2 t.toLowerCase() t.toLowerCase t if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break; w2.equals(t2) w2.equals w2 t2 count++ count if (t.equals("END_OF_TEXT")) break; t.equals("END_OF_TEXT") t.equals t "END_OF_TEXT" break; System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String w = sc.next();
        String w2 = w.toLowerCase();
        String t = "",t2="";
        while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String w = sc.next();
        String w2 = w.toLowerCase();
        String t = "",t2="";
        while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        String w = sc.next();
        String w2 = w.toLowerCase();
        String t = "",t2="";
        while (true) {
            t = sc.next();
            t2 = t.toLowerCase();
            if (w2.equals(t2)) count++;
            else if (t.equals("END_OF_TEXT")) break;
        }
        System.out.println(count);
    }
}

