import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String comparison = scan.next();
        String word;
        int count = 0;
        while ("END_OF_TEXT".equals((word = scan.next())) == false) {
            if (word.equalsIgnoreCase(comparison))
                count++;
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String comparison = scan.next();
        String word;
        int count = 0;
        while ("END_OF_TEXT".equals((word = scan.next())) == false) {
            if (word.equalsIgnoreCase(comparison))
                count++;
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String comparison = scan.next();
        String word;
        int count = 0;
        while ("END_OF_TEXT".equals((word = scan.next())) == false) {
            if (word.equalsIgnoreCase(comparison))
                count++;
        }
        System.out.println(count);
    } main {
        Scanner scan = new Scanner(System.in);
        String comparison = scan.next();
        String word;
        int count = 0;
        while ("END_OF_TEXT".equals((word = scan.next())) == false) {
            if (word.equalsIgnoreCase(comparison))
                count++;
        }
        System.out.println(count);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String comparison = scan.next(); comparison scan.next() scan.next scan String word; word int count = 0; count 0 while ("END_OF_TEXT".equals((word = scan.next())) == false) {
            if (word.equalsIgnoreCase(comparison))
                count++;
        } "END_OF_TEXT".equals((word = scan.next())) == false "END_OF_TEXT".equals((word = scan.next())) "END_OF_TEXT".equals "END_OF_TEXT" (word = scan.next()) word scan.next() scan.next scan false {
            if (word.equalsIgnoreCase(comparison))
                count++;
        } if (word.equalsIgnoreCase(comparison))
                count++; word.equalsIgnoreCase(comparison) word.equalsIgnoreCase word comparison count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;

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