import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        List<String> list = new ArrayList<>();
        while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        }
        long sum = 0;
        for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util 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();
        List<String> list = new ArrayList<>();
        while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        }
        long sum = 0;
        for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        List<String> list = new ArrayList<>();
        while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        }
        long sum = 0;
        for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        }
        System.out.println(sum);
    } main {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        List<String> list = new ArrayList<>();
        while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        }
        long sum = 0;
        for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String word = sc.next(); word sc.next() sc.next sc List<String> list = new ArrayList<>(); list new ArrayList<>() while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        } true {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        } String s = sc.next(); s sc.next() sc.next sc if (s.equals("END_OF_TEXT")) {
                break;
            } s.equals("END_OF_TEXT") s.equals s "END_OF_TEXT" {
                break;
            } break; list.add(s.toLowerCase()) list.add list s.toLowerCase() s.toLowerCase s long sum = 0; sum 0 for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        } String s list {
            if (s.equals(word)) {
                sum++;
            }
        } {
            if (s.equals(word)) {
                sum++;
            }
        } if (s.equals(word)) {
                sum++;
            } s.equals(word) s.equals s word {
                sum++;
            } sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        List<String> list = new ArrayList<>();
        while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        }
        long sum = 0;
        for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        List<String> list = new ArrayList<>();
        while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        }
        long sum = 0;
        for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        }
        System.out.println(sum);
    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();
        List<String> list = new ArrayList<>();
        while (true) {
            String s = sc.next();
            if (s.equals("END_OF_TEXT")) {
                break;
            }
            list.add(s.toLowerCase());
        }
        long sum = 0;
        for (String s : list) {
            if (s.equals(word)) {
                sum++;
            }
        }
        System.out.println(sum);
    }
}