import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String key = sc.nextLine(); key sc.nextLine() sc.nextLine sc String BREAKW="END_OF_TEXT"; BREAKW "END_OF_TEXT" int count=0; count 0 String ans = ""; ans "" while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        } true {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        } String str =sc.nextLine(); str sc.nextLine() sc.nextLine sc if(str.equals(BREAKW))break; str.equals(BREAKW) str.equals str BREAKW break; ans = ans +" "+str ans ans +" "+str ans +" "+str ans " " str String word[] = ans.split(" "); word ans.split(" ") ans.split ans " " for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        } int i=0; int i=0; i 0 i<word.length i word.length word word.length i++ i++ i {
        	if(word[i].equalsIgnoreCase(key))count++;
        } {
        	if(word[i].equalsIgnoreCase(key))count++;
        } if(word[i].equalsIgnoreCase(key))count++; word[i].equalsIgnoreCase(key) word[i].equalsIgnoreCase word[i] word i key count++ count System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String key = sc.nextLine();
        String BREAKW="END_OF_TEXT";
        int count=0;
        String ans = "";
        while(true) {
            String str =sc.nextLine();
            if(str.equals(BREAKW))break;
            ans = ans +" "+str;
        }

        String word[] = ans.split(" ");
        for(int i=0;i<word.length;i++) {
        	if(word[i].equalsIgnoreCase(key))count++;
        }
         System.out.println(count);
        sc.close();
    }
}
