import java.util.*;
 
public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String obj;
        String str;
        int counter=0;
        
        obj=scan.nextLine();
        
        scan.useDelimiter("\\s");
        
        while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        }
        
        System.out.println(counter);
    }
        
} import java.util.*; util.* java public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String obj;
        String str;
        int counter=0;
        
        obj=scan.nextLine();
        
        scan.useDelimiter("\\s");
        
        while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        }
        
        System.out.println(counter);
    }
        
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String obj;
        String str;
        int counter=0;
        
        obj=scan.nextLine();
        
        scan.useDelimiter("\\s");
        
        while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        }
        
        System.out.println(counter);
    } main {
        Scanner scan=new Scanner(System.in);
        String obj;
        String str;
        int counter=0;
        
        obj=scan.nextLine();
        
        scan.useDelimiter("\\s");
        
        while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        }
        
        System.out.println(counter);
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String obj; obj String str; str int counter=0; counter 0 obj=scan.nextLine() obj scan.nextLine() scan.nextLine scan scan.useDelimiter("\\s") scan.useDelimiter scan "\\s" while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        } !((str=scan.next()).equals("END_OF_TEXT")) ((str=scan.next()).equals("END_OF_TEXT")) (str=scan.next()).equals (str=scan.next()) str scan.next() scan.next scan "END_OF_TEXT" {
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        } str=str.toLowerCase() str str.toLowerCase() str.toLowerCase str if(str.equals(obj)){
                counter++;
            } str.equals(obj) str.equals str obj {
                counter++;
            } counter++ counter System.out.println(counter) System.out.println System.out System System.out counter String[] args args public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String obj;
        String str;
        int counter=0;
        
        obj=scan.nextLine();
        
        scan.useDelimiter("\\s");
        
        while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        }
        
        System.out.println(counter);
    }
        
} public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String obj;
        String str;
        int counter=0;
        
        obj=scan.nextLine();
        
        scan.useDelimiter("\\s");
        
        while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        }
        
        System.out.println(counter);
    }
        
} Main
import java.util.*;
 
public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String obj;
        String str;
        int counter=0;
        
        obj=scan.nextLine();
        
        scan.useDelimiter("\\s");
        
        while(!((str=scan.next()).equals("END_OF_TEXT"))){
            str=str.toLowerCase();
            if(str.equals(obj)){
                counter++;
            }
        }
        
        System.out.println(counter);
    }
        
}