import java.io.*;
import java.util.Scanner;


public class Main{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        int i = 0;

        do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true);
            
    }
}

 import java.io.*; io.* java import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        int i = 0;

        do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true);
            
    }
} Main public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        int i = 0;

        do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true);
            
    } main {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        int i = 0;

        do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true);
            
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String word = scanner.nextLine(); word scanner.nextLine() scanner.nextLine scanner int i = 0; i 0 do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true); true {
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        } String line = scanner.next(); line scanner.next() scanner.next scanner if(line.equalsIgnoreCase(word)){
                i++;
            } line.equalsIgnoreCase(word) line.equalsIgnoreCase line word {
                i++;
            } i++ i if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            } line.equals("END_OF_TEXT") line.equals line "END_OF_TEXT" {
                System.out.println(i);
                break;
            } System.out.println(i) System.out.println System.out System System.out i break; String[] args args public class Main{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        int i = 0;

        do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true);
            
    }
} public class Main{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        int i = 0;

        do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true);
            
    }
} Main
import java.io.*;
import java.util.Scanner;


public class Main{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        String word = scanner.nextLine();
        int i = 0;

        do{
            String line = scanner.next();
            if(line.equalsIgnoreCase(word)){
                i++;
            }

            if(line.equals("END_OF_TEXT")){
                System.out.println(i);
                break;
            }
        }while(true);
            
    }
}


