import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W = sc.next();
        String[] T = new String[10000];
        int i = 0;
        do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true);
        int wordCount = 0;
        for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        }
        System.out.println(wordCount);
        sc.close();
    }   
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W = sc.next();
        String[] T = new String[10000];
        int i = 0;
        do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true);
        int wordCount = 0;
        for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        }
        System.out.println(wordCount);
        sc.close();
    }   
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W = sc.next();
        String[] T = new String[10000];
        int i = 0;
        do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true);
        int wordCount = 0;
        for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        }
        System.out.println(wordCount);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String W = sc.next();
        String[] T = new String[10000];
        int i = 0;
        do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true);
        int wordCount = 0;
        for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        }
        System.out.println(wordCount);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String W = sc.next(); W sc.next() sc.next sc String[] T = new String[10000]; T new String[10000] 10000 int i = 0; i 0 do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true); true {
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } T[i] = sc.next() T[i] T i sc.next() sc.next sc if(T[i].equals("END_OF_TEXT")){
                break;
            } T[i].equals("END_OF_TEXT") T[i].equals T[i] T i "END_OF_TEXT" {
                break;
            } break; T[i] = T[i].toLowerCase() T[i] T i T[i].toLowerCase() T[i].toLowerCase T[i] T i i++ i int wordCount = 0; wordCount 0 for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        } int j = 0; int j = 0; j 0 j < i j i j++ j++ j {
            if (W.equals(T[j])) {
                wordCount++;
            }
        } {
            if (W.equals(T[j])) {
                wordCount++;
            }
        } if (W.equals(T[j])) {
                wordCount++;
            } W.equals(T[j]) W.equals W T[j] T j {
                wordCount++;
            } wordCount++ wordCount System.out.println(wordCount) System.out.println System.out System System.out wordCount sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W = sc.next();
        String[] T = new String[10000];
        int i = 0;
        do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true);
        int wordCount = 0;
        for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        }
        System.out.println(wordCount);
        sc.close();
    }   
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W = sc.next();
        String[] T = new String[10000];
        int i = 0;
        do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true);
        int wordCount = 0;
        for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        }
        System.out.println(wordCount);
        sc.close();
    }   
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W = sc.next();
        String[] T = new String[10000];
        int i = 0;
        do{
            T[i] = sc.next();
            if(T[i].equals("END_OF_TEXT")){
                break;
            }
            T[i] = T[i].toLowerCase();
            i++;
        } while (true);
        int wordCount = 0;
        for (int j = 0; j < i; j++) {
            if (W.equals(T[j])) {
                wordCount++;
            }
        }
        System.out.println(wordCount);
        sc.close();
    }   
}
