import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W=sc.next();
        int sum=0;
        while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        }
        System.out.println(sum);
        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();
        int sum=0;
        while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        }
        System.out.println(sum);
        sc.close();
    } 
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W=sc.next();
        int sum=0;
        while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        }
        System.out.println(sum);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String W=sc.next();
        int sum=0;
        while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        }
        System.out.println(sum);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String W=sc.next(); W sc.next() sc.next sc int sum=0; sum 0 while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        } true {
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        } String H=sc.next(); H sc.next() sc.next sc if(H.equals("END_OF_TEXT"))break; H.equals("END_OF_TEXT") H.equals H "END_OF_TEXT" break; if(H.equalsIgnoreCase(W))sum++; H.equalsIgnoreCase(W) H.equalsIgnoreCase H W sum++ sum System.out.println(sum) System.out.println System.out System System.out sum 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();
        int sum=0;
        while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        }
        System.out.println(sum);
        sc.close();
    } 
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String W=sc.next();
        int sum=0;
        while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        }
        System.out.println(sum);
        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();
        int sum=0;
        while(true){
            String H=sc.next();
            if(H.equals("END_OF_TEXT"))break;
            if(H.equalsIgnoreCase(W))sum++;
        }
        System.out.println(sum);
        sc.close();
    } 
}
