import java.util.Scanner;

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

        int count = 0;
        String key = sc.next();
        key = key.toLowerCase();

        String read = sc.next();
        while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        }
        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);

        int count = 0;
        String key = sc.next();
        key = key.toLowerCase();

        String read = sc.next();
        while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        }
        System.out.println(count);

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

        int count = 0;
        String key = sc.next();
        key = key.toLowerCase();

        String read = sc.next();
        while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        }
        System.out.println(count);

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int count = 0;
        String key = sc.next();
        key = key.toLowerCase();

        String read = sc.next();
        while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        }
        System.out.println(count);

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 String key = sc.next(); key sc.next() sc.next sc key = key.toLowerCase() key key.toLowerCase() key.toLowerCase key String read = sc.next(); read sc.next() sc.next sc while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        } !(read.equals("END_OF_TEXT")) (read.equals("END_OF_TEXT")) read.equals read "END_OF_TEXT" {
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        } read = read.toLowerCase() read read.toLowerCase() read.toLowerCase read if(read.equals(key))
                count++; read.equals(key) read.equals read key count++ count read = sc.next() read sc.next() sc.next sc 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);

        int count = 0;
        String key = sc.next();
        key = key.toLowerCase();

        String read = sc.next();
        while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        }
        System.out.println(count);

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

        int count = 0;
        String key = sc.next();
        key = key.toLowerCase();

        String read = sc.next();
        while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        }
        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);

        int count = 0;
        String key = sc.next();
        key = key.toLowerCase();

        String read = sc.next();
        while(!(read.equals("END_OF_TEXT"))){
            read = read.toLowerCase();
            if(read.equals(key))
                count++;
            read = sc.next();
        }
        System.out.println(count);

        sc.close();
    }
}
