
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String word = reader.readLine();
        int count = 0;
        while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String word = reader.readLine();
        int count = 0;
        while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String word = reader.readLine();
        int count = 0;
        while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    } main {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String word = reader.readLine();
        int count = 0;
        while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String word = reader.readLine(); word reader.readLine() reader.readLine reader int count = 0; count 0 while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        } true {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        } String sentence = reader.readLine(); sentence reader.readLine() reader.readLine reader String[] words = sentence.split(" "); words sentence.split(" ") sentence.split sentence " " if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            } words[0].equals("END_OF_TEXT") words[0].equals words[0] words 0 "END_OF_TEXT" {
                break;
            } break; {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            } for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                } int i = 0; int i = 0; i 0 i < words.length i words.length words words.length i++ i++ i {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                } {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                } if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    } word.equalsIgnoreCase(words[i]) word.equalsIgnoreCase word words[i] words i {
                        count++;
                    } 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) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String word = reader.readLine();
        int count = 0;
        while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String word = reader.readLine();
        int count = 0;
        while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String word = reader.readLine();
        int count = 0;
        while (true) {

            String sentence = reader.readLine();
            String[] words = sentence.split(" ");
            if (words[0].equals("END_OF_TEXT")) {
                break;
            } else {
                for (int i = 0; i < words.length; i++) {
                    if (word.equalsIgnoreCase(words[i])) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}