import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    } main {
        Scanner scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String W = scan.nextLine(); W scan.nextLine() scan.nextLine scan int count = 0; count 0 while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        } scan.hasNext() scan.hasNext scan {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        } if (W.equals("END_OF_TEXT")) break; W.equals("END_OF_TEXT") W.equals W "END_OF_TEXT" break; String s = scan.next(); s scan.next() scan.next scan if (s.equalsIgnoreCase(W)) count++; s.equalsIgnoreCase(W) s.equalsIgnoreCase s W count++ count 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 scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String W = scan.nextLine();
        int count = 0;
        while (scan.hasNext()) {
        if (W.equals("END_OF_TEXT")) break;
                String s = scan.next();
                if (s.equalsIgnoreCase(W)) count++;
        }
        System.out.println(count);
    }
}