import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    } main {
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String x = sc.next(); x sc.next() sc.next sc int count = 0; count 0 while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        } true {
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        } String a = sc.next(); a sc.next() sc.next sc if(a.equals("END_OF_TEXT")) break; a.equals("END_OF_TEXT") a.equals a "END_OF_TEXT" break; if(a.equalsIgnoreCase(x)) count++; a.equalsIgnoreCase(x) a.equalsIgnoreCase a x count++ count System.out.printf("%d\n",count) System.out.printf System.out System System.out "%d\n" count String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    }
}
