import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> str = new ArrayList<>();
        String target = sc.next().toLowerCase();
        while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        }
        sc.close();

        System.out.println(Collections.frequency(str, target));
    }
}
 import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> str = new ArrayList<>();
        String target = sc.next().toLowerCase();
        while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        }
        sc.close();

        System.out.println(Collections.frequency(str, target));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> str = new ArrayList<>();
        String target = sc.next().toLowerCase();
        while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        }
        sc.close();

        System.out.println(Collections.frequency(str, target));
    } main {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> str = new ArrayList<>();
        String target = sc.next().toLowerCase();
        while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        }
        sc.close();

        System.out.println(Collections.frequency(str, target));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<String> str = new ArrayList<>(); str new ArrayList<>() String target = sc.next().toLowerCase(); target sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        } true {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        } String tmp = sc.next(); tmp sc.next() sc.next sc if(tmp.equals("END_OF_TEXT")) {
                break;
            } tmp.equals("END_OF_TEXT") tmp.equals tmp "END_OF_TEXT" {
                break;
            } break; str.add(tmp.toLowerCase()) str.add str tmp.toLowerCase() tmp.toLowerCase tmp sc.close() sc.close sc System.out.println(Collections.frequency(str, target)) System.out.println System.out System System.out Collections.frequency(str, target) Collections.frequency Collections str target String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> str = new ArrayList<>();
        String target = sc.next().toLowerCase();
        while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        }
        sc.close();

        System.out.println(Collections.frequency(str, target));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> str = new ArrayList<>();
        String target = sc.next().toLowerCase();
        while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        }
        sc.close();

        System.out.println(Collections.frequency(str, target));
    }
} Main
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<String> str = new ArrayList<>();
        String target = sc.next().toLowerCase();
        while(true) {
            String tmp = sc.next();
            if(tmp.equals("END_OF_TEXT")) {
                break;
            }
            str.add(tmp.toLowerCase());
        }
        sc.close();

        System.out.println(Collections.frequency(str, target));
    }
}

