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

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String searchWord = sc.next().toLowerCase();
        ArrayList<String> stringArray = new ArrayList<String>();
        String target = "";
        while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        }
        int count = 0;
        for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        }
        System.out.println(count);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String searchWord = sc.next().toLowerCase();
        ArrayList<String> stringArray = new ArrayList<String>();
        String target = "";
        while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        }
        int count = 0;
        for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String searchWord = sc.next().toLowerCase();
        ArrayList<String> stringArray = new ArrayList<String>();
        String target = "";
        while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        }
        int count = 0;
        for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        String searchWord = sc.next().toLowerCase();
        ArrayList<String> stringArray = new ArrayList<String>();
        String target = "";
        while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        }
        int count = 0;
        for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String searchWord = sc.next().toLowerCase(); searchWord sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc ArrayList<String> stringArray = new ArrayList<String>(); stringArray new ArrayList<String>() String target = ""; target "" while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        } true {
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        } target = sc.next() target sc.next() sc.next sc if(target.equals("END_OF_TEXT")) break; target.equals("END_OF_TEXT") target.equals target "END_OF_TEXT" break; stringArray.add(target.toLowerCase()) stringArray.add stringArray target.toLowerCase() target.toLowerCase target int count = 0; count 0 for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        } String str stringArray {
            if(str.equals(searchWord)){
                count++;
            }
        } {
            if(str.equals(searchWord)){
                count++;
            }
        } if(str.equals(searchWord)){
                count++;
            } str.equals(searchWord) str.equals str searchWord {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String searchWord = sc.next().toLowerCase();
        ArrayList<String> stringArray = new ArrayList<String>();
        String target = "";
        while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        }
        int count = 0;
        for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        }
        System.out.println(count);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String searchWord = sc.next().toLowerCase();
        ArrayList<String> stringArray = new ArrayList<String>();
        String target = "";
        while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        }
        int count = 0;
        for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String searchWord = sc.next().toLowerCase();
        ArrayList<String> stringArray = new ArrayList<String>();
        String target = "";
        while(true){
            target = sc.next();
            if(target.equals("END_OF_TEXT")) break;
            stringArray.add(target.toLowerCase());
        }
        int count = 0;
        for(String str: stringArray){
            if(str.equals(searchWord)){
                count++;
            }
        }
        System.out.println(count);
    }
}
