import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
    private static int W = 10;
    private static int T = 1000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        }
    }
}
 import java.util.NoSuchElementException; NoSuchElementException java.util import java.util.Scanner; Scanner java.util public class Main {
    private static int W = 10;
    private static int T = 1000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        }
    }
} Main private static int W = 10; W 10 private static int T = 1000; T 1000 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        } NoSuchElementException e {
            System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } String w = sc.nextLine(); w sc.nextLine() sc.nextLine sc if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            } w.length() > W w.length() w.length w W {
                System.out.println("Condition is invalid.");
                return;
            } System.out.println("Condition is invalid.") System.out.println System.out System System.out "Condition is invalid." return; int c = 0; c 0 while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            } sc.hasNext() sc.hasNext sc {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            } String s = sc.next().toLowerCase(); s sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc if (s.equals("END_OF_TEXT")) {
                    break;
                } s.equals("END_OF_TEXT") s.equals s "END_OF_TEXT" {
                    break;
                } break; if (s.equals(w)) {
                    c++;
                } s.equals(w) s.equals s w {
                    c++;
                } c++ c System.out.println(c) System.out.println System.out System System.out c String[] args args public class Main {
    private static int W = 10;
    private static int T = 1000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        }
    }
} public class Main {
    private static int W = 10;
    private static int T = 1000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        }
    }
} Main
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
    private static int W = 10;
    private static int T = 1000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String w = sc.nextLine();
            if (w.length() > W) {
                System.out.println("Condition is invalid.");
                return;
            }
            int c = 0;
            while (sc.hasNext()) {
                String s = sc.next().toLowerCase();
                if (s.equals("END_OF_TEXT")) {
                    break;
                }
                if (s.equals(w)) {
                    c++;
                }
            }
            System.out.println(c);
        } catch (NoSuchElementException e) {
            System.out.println(e);
        }
    }
}

