import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String word = scn.nextLine();
        int ans = 0;

        while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        }
        System.out.println(ans);

        scn.close();


    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String word = scn.nextLine();
        int ans = 0;

        while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        }
        System.out.println(ans);

        scn.close();


    }

} Main public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String word = scn.nextLine();
        int ans = 0;

        while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        }
        System.out.println(ans);

        scn.close();


    } main {
        Scanner scn = new Scanner(System.in);
        String word = scn.nextLine();
        int ans = 0;

        while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        }
        System.out.println(ans);

        scn.close();


    } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String word = scn.nextLine(); word scn.nextLine() scn.nextLine scn int ans = 0; ans 0 while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        } scn.hasNext() scn.hasNext scn {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        } String check = scn.next(); check scn.next() scn.next scn check.replace(".","") check.replace check "." "" check.replace("?","") check.replace check "?" "" check.replace("!","") check.replace check "!" "" if(check.equalsIgnoreCase(word)){
                ans +=1;
            } check.equalsIgnoreCase(word) check.equalsIgnoreCase check word {
                ans +=1;
            } ans +=1 ans 1 System.out.println(ans) System.out.println System.out System System.out ans scn.close() scn.close scn String args[] args public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String word = scn.nextLine();
        int ans = 0;

        while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        }
        System.out.println(ans);

        scn.close();


    }

} public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String word = scn.nextLine();
        int ans = 0;

        while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        }
        System.out.println(ans);

        scn.close();


    }

} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        String word = scn.nextLine();
        int ans = 0;

        while (scn.hasNext()) {
            String check = scn.next();

            check.replace(".","");
            check.replace("?","");
            check.replace("!","");
            if(check.equalsIgnoreCase(word)){
                ans +=1;
            }

        }
        System.out.println(ans);

        scn.close();


    }

}
