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

