import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        int count = 0;
        char c;
        String word, temp;
        Scanner sc = new Scanner(System.in);
        word = sc.next();
        temp = sc.next();
        
        while (!temp.equals("END_OF_TEXT")) {
            if (temp.equalsIgnoreCase(word)) 
                count++;
            temp = sc.next();
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        int count = 0;
        char c;
        String word, temp;
        Scanner sc = new Scanner(System.in);
        word = sc.next();
        temp = sc.next();
        
        while (!temp.equals("END_OF_TEXT")) {
            if (temp.equalsIgnoreCase(word)) 
                count++;
            temp = sc.next();
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        int count = 0;
        char c;
        String word, temp;
        Scanner sc = new Scanner(System.in);
        word = sc.next();
        temp = sc.next();
        
        while (!temp.equals("END_OF_TEXT")) {
            if (temp.equalsIgnoreCase(word)) 
                count++;
            temp = sc.next();
        }
        System.out.println(count);
    } main {
        int count = 0;
        char c;
        String word, temp;
        Scanner sc = new Scanner(System.in);
        word = sc.next();
        temp = sc.next();
        
        while (!temp.equals("END_OF_TEXT")) {
            if (temp.equalsIgnoreCase(word)) 
                count++;
            temp = sc.next();
        }
        System.out.println(count);
    } int count = 0; count 0 char c; c String word word temp; temp Scanner sc = new Scanner(System.in); sc new Scanner(System.in) word = sc.next() word sc.next() sc.next sc temp = sc.next() temp sc.next() sc.next sc while (!temp.equals("END_OF_TEXT")) {
            if (temp.equalsIgnoreCase(word)) 
                count++;
            temp = sc.next();
        } !temp.equals("END_OF_TEXT") temp.equals("END_OF_TEXT") temp.equals temp "END_OF_TEXT" {
            if (temp.equalsIgnoreCase(word)) 
                count++;
            temp = sc.next();
        } if (temp.equalsIgnoreCase(word)) 
                count++; temp.equalsIgnoreCase(word) temp.equalsIgnoreCase temp word count++ count temp = sc.next() temp sc.next() sc.next sc 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) {
        int count = 0;
        char c;
        String word, temp;
        Scanner sc = new Scanner(System.in);
        word = sc.next();
        temp = sc.next();
        
        while (!temp.equals("END_OF_TEXT")) {
            if (temp.equalsIgnoreCase(word)) 
                count++;
            temp = sc.next();
        }
        System.out.println(count);
    }
}
