import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        }

        System.out.printf("%d\n",count);

    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        }

        System.out.printf("%d\n",count);

    }
} Main public static void main(String[] args){
        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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        }

        System.out.printf("%d\n",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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        }

        System.out.printf("%d\n",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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        } true {
            String text = sc.next();

            if(text.equals("END_OF_TEXT"))break;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        } String 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; if(word.compareToIgnoreCase(text) == 0){
                count++;
            } word.compareToIgnoreCase(text) == 0 word.compareToIgnoreCase(text) word.compareToIgnoreCase word text 0 {
                count++;
            } count++ count System.out.printf("%d\n",count) System.out.printf System.out System System.out "%d\n" count String[] args args public class Main{
    public static void main(String[] args){
        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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        }

        System.out.printf("%d\n",count);

    }
} public class Main{
    public static void main(String[] args){
        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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        }

        System.out.printf("%d\n",count);

    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        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;

            if(word.compareToIgnoreCase(text) == 0){
                count++;
            }
        }

        System.out.printf("%d\n",count);

    }
}
