import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String W = scanner.next().toLowerCase();
        String tmp;
        int count = 0;
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String W = scanner.next().toLowerCase();
        String tmp;
        int count = 0;
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String W = scanner.next().toLowerCase();
        String tmp;
        int count = 0;
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);
        String W = scanner.next().toLowerCase();
        String tmp;
        int count = 0;
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String W = scanner.next().toLowerCase(); W scanner.next().toLowerCase() scanner.next().toLowerCase scanner.next() scanner.next scanner String tmp; tmp int count = 0; count 0 while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        } !(tmp = scanner.next()).equals("END_OF_TEXT") (tmp = scanner.next()).equals("END_OF_TEXT") (tmp = scanner.next()).equals (tmp = scanner.next()) tmp scanner.next() scanner.next scanner "END_OF_TEXT" {
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        } if(tmp.equalsIgnoreCase(W)){
                count++;
            } tmp.equalsIgnoreCase(W) tmp.equalsIgnoreCase tmp W {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String W = scanner.next().toLowerCase();
        String tmp;
        int count = 0;
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String W = scanner.next().toLowerCase();
        String tmp;
        int count = 0;
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String W = scanner.next().toLowerCase();
        String tmp;
        int count = 0;
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
            if(tmp.equalsIgnoreCase(W)){
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    }
}
