
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    }

}
 import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    }

} Main public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    } main {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    } Scanner scanner=new Scanner(System.in); scanner new Scanner(System.in) String w= scanner.next(); w scanner.next() scanner.next scanner long result=0; result 0 while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        } true {
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        } String t=scanner.next(); t scanner.next() scanner.next scanner if(t.equals("END_OF_TEXT")) break; t.equals("END_OF_TEXT") t.equals t "END_OF_TEXT" break; t=t.toLowerCase() t t.toLowerCase() t.toLowerCase t if(t.equals(w)) result++; t.equals(w) t.equals t w result++ result System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    }

} public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    }

} Main

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    }

}

