import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s, text[];
        text = new String[10000000];
        int count = 0;
        s = sc.next();

        int i = 0;
        while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        }
        System.out.println(count);
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s, text[];
        text = new String[10000000];
        int count = 0;
        s = sc.next();

        int i = 0;
        while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        }
        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s, text[];
        text = new String[10000000];
        int count = 0;
        s = sc.next();

        int i = 0;
        while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);

        String s, text[];
        text = new String[10000000];
        int count = 0;
        s = sc.next();

        int i = 0;
        while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s s text[]; text text = new String[10000000] text new String[10000000] 10000000 int count = 0; count 0 s = sc.next() s sc.next() sc.next sc int i = 0; i 0 while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        } true {
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        } text[i] = sc.next() text[i] text i sc.next() sc.next sc if(text[i].equals("END_OF_TEXT")){
                break;
            } text[i].equals("END_OF_TEXT") text[i].equals text[i] text i "END_OF_TEXT" {
                break;
            } break; text[i] = text[i].toLowerCase() text[i] text i text[i].toLowerCase() text[i].toLowerCase text[i] text i if(text[i].equals(s)){
                count++;
            } text[i].equals(s) text[i].equals text[i] text i s {
                count++;
            } count++ count ++i i 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){
        Scanner sc = new Scanner(System.in);

        String s, text[];
        text = new String[10000000];
        int count = 0;
        s = sc.next();

        int i = 0;
        while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s, text[];
        text = new String[10000000];
        int count = 0;
        s = sc.next();

        int i = 0;
        while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s, text[];
        text = new String[10000000];
        int count = 0;
        s = sc.next();

        int i = 0;
        while(true){
            text[i] = sc.next();

            if(text[i].equals("END_OF_TEXT")){
                break;
            }

            text[i] = text[i].toLowerCase();

            if(text[i].equals(s)){
                count++;
            }

            ++i;
        }
        System.out.println(count);
    }
}

