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().toString();
        String cmp;

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

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

        String input = sc.next();
        while(! input.equals("END_OF_TEXT")) {
            cmp = input.toLowerCase();
            if(cmp.equals(key))
                count++;
            input = sc.next();
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

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

        String input = sc.next();
        while(! input.equals("END_OF_TEXT")) {
            cmp = input.toLowerCase();
            if(cmp.equals(key))
                count++;
            input = sc.next();
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);

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

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

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

        String input = sc.next();
        while(! input.equals("END_OF_TEXT")) {
            cmp = input.toLowerCase();
            if(cmp.equals(key))
                count++;
            input = sc.next();
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

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

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

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

