import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String word = sc.nextLine();
        int count = 0;
        while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
} 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 word = sc.nextLine();
        int count = 0;
        while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String word = sc.nextLine();
        int count = 0;
        while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        String word = sc.nextLine();
        int count = 0;
        while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String word = sc.nextLine(); word sc.nextLine() sc.nextLine sc int count = 0; count 0 while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        } true {
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        } String text = sc.nextLine(); text sc.nextLine() sc.nextLine sc if(text.equals("END_OF_TEXT")){
                break;
            } text.equals("END_OF_TEXT") text.equals text "END_OF_TEXT" {
                break;
            } break; String[] t = text.split(" "); t text.split(" ") text.split text " " for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            } String t_word t {
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            } {
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            } if(t_word.equalsIgnoreCase(word)){
                    count++;
                } t_word.equalsIgnoreCase(word) t_word.equalsIgnoreCase t_word word {
                    count++;
                } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String word = sc.nextLine();
        int count = 0;
        while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String word = sc.nextLine();
        int count = 0;
        while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String word = sc.nextLine();
        int count = 0;
        while(true){
            String text = sc.nextLine();
            if(text.equals("END_OF_TEXT")){
                break;
            }
            String[] t = text.split(" ");
            for(String t_word:t){
                if(t_word.equalsIgnoreCase(word)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}