import java.util.Scanner;

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

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