import java.util.Scanner;
public class Main{
    public static void main(String[] args) throws Exception {
         
        Scanner sc = new Scanner(System.in);
        
        String W = sc.next();
        int count = 0;
        W = W.toUpperCase();
        
        
        while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        }
        System.out.println(count);
        sc.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) throws Exception {
         
        Scanner sc = new Scanner(System.in);
        
        String W = sc.next();
        int count = 0;
        W = W.toUpperCase();
        
        
        while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        }
        System.out.println(count);
        sc.close();
    }
} Main public static void main(String[] args) throws Exception {
         
        Scanner sc = new Scanner(System.in);
        
        String W = sc.next();
        int count = 0;
        W = W.toUpperCase();
        
        
        while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        }
        System.out.println(count);
        sc.close();
    } main {
         
        Scanner sc = new Scanner(System.in);
        
        String W = sc.next();
        int count = 0;
        W = W.toUpperCase();
        
        
        while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        }
        System.out.println(count);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String W = sc.next(); W sc.next() sc.next sc int count = 0; count 0 W = W.toUpperCase() W W.toUpperCase() W.toUpperCase W while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        } true {
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        } String T = sc.next(); T sc.next() sc.next sc if( T.equals( "END_OF_TEXT" ) )
                break; T.equals( "END_OF_TEXT" ) T.equals T "END_OF_TEXT" break; T = T.toUpperCase() T T.toUpperCase() T.toUpperCase T if( T.equals(W))
                count++; T.equals(W) T.equals T W count++ count System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args) throws Exception {
         
        Scanner sc = new Scanner(System.in);
        
        String W = sc.next();
        int count = 0;
        W = W.toUpperCase();
        
        
        while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        }
        System.out.println(count);
        sc.close();
    }
} public class Main{
    public static void main(String[] args) throws Exception {
         
        Scanner sc = new Scanner(System.in);
        
        String W = sc.next();
        int count = 0;
        W = W.toUpperCase();
        
        
        while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        }
        System.out.println(count);
        sc.close();
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args) throws Exception {
         
        Scanner sc = new Scanner(System.in);
        
        String W = sc.next();
        int count = 0;
        W = W.toUpperCase();
        
        
        while(true){
            String T = sc.next();
            if( T.equals( "END_OF_TEXT" ) )
                break;
            T = T.toUpperCase();
            if( T.equals(W))
                count++;
        }
        System.out.println(count);
        sc.close();
    }
}

