import java.util.Scanner;

public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        int count=0;
        while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        }
        System.out.println(count);
    }
}
 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        int count=0;
        while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        int count=0;
        while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        int count=0;
        while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String word = sc.next(); word sc.next() sc.next sc int count=0; count 0 while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        } true {
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        } String text = sc.next(); text sc.next() sc.next sc if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            } text.equals("END_OF_TEXT") text.equals text "END_OF_TEXT" {
                break;
            } break; if(text.equalsIgnoreCase(word)){
                count++;
            } text.equalsIgnoreCase(word) text.equalsIgnoreCase text word {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[]argc argc public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        int count=0;
        while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        }
        System.out.println(count);
    }
} public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        int count=0;
        while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        int count=0;
        while(true){
            String text = sc.next();
            if(text.equals("END_OF_TEXT")){
                break;
            }else if(text.equalsIgnoreCase(word)){
                count++;
            }
        }
        System.out.println(count);
    }
}

