import java.util.Scanner;

/**
 * Finding a Word
 */
public class Main {

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

        String keyword = scan.next().toLowerCase();
        String str = null;
        int match = 0;
        while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        }
        System.out.println(match);
    }
} import java.util.Scanner; Scanner java.util public class Main {

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

        String keyword = scan.next().toLowerCase();
        String str = null;
        int match = 0;
        while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        }
        System.out.println(match);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        String keyword = scan.next().toLowerCase();
        String str = null;
        int match = 0;
        while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        }
        System.out.println(match);
    } main {
        Scanner scan = new Scanner(System.in);

        String keyword = scan.next().toLowerCase();
        String str = null;
        int match = 0;
        while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        }
        System.out.println(match);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String keyword = scan.next().toLowerCase(); keyword scan.next().toLowerCase() scan.next().toLowerCase scan.next() scan.next scan String str = null; str null int match = 0; match 0 while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        } scan.hasNext() scan.hasNext scan {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        } str = scan.next() str scan.next() scan.next scan if (str.matches("END_OF_TEXT")) {
                break;
            } str.matches("END_OF_TEXT") str.matches str "END_OF_TEXT" {
                break;
            } break; if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            } str.toLowerCase().matches(keyword) str.toLowerCase().matches str.toLowerCase() str.toLowerCase str keyword {
                match ++ ;
            } match ++ match System.out.println(match) System.out.println System.out System System.out match String[] args args public class Main {

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

        String keyword = scan.next().toLowerCase();
        String str = null;
        int match = 0;
        while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        }
        System.out.println(match);
    }
} public class Main {

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

        String keyword = scan.next().toLowerCase();
        String str = null;
        int match = 0;
        while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        }
        System.out.println(match);
    }
} Main
import java.util.Scanner;

/**
 * Finding a Word
 */
public class Main {

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

        String keyword = scan.next().toLowerCase();
        String str = null;
        int match = 0;
        while (scan.hasNext()) {
            str = scan.next();
            if (str.matches("END_OF_TEXT")) {
                break;
            }
            if (str.toLowerCase().matches(keyword)) {
                match ++ ;
            }
        }
        System.out.println(match);
    }
}