import java.util.Scanner;                                                   

public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String w = in.next();
        int a = 0;
        while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        }
        System.out.println(a);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String w = in.next();
        int a = 0;
        while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        }
        System.out.println(a);
    }
} Main public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String w = in.next();
        int a = 0;
        while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        }
        System.out.println(a);
    } main {
        Scanner in = new Scanner(System.in);
        String w = in.next();
        int a = 0;
        while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        }
        System.out.println(a);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String w = in.next(); w in.next() in.next in int a = 0; a 0 while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        } in.hasNext() in.hasNext in {
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        } String str = in.next(); str in.next() in.next in if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            } str.equals("END_OF_TEXT") str.equals str "END_OF_TEXT" {
                break;
            } break; if(str.equalsIgnoreCase(w)){
            a++;
            } str.equalsIgnoreCase(w) str.equalsIgnoreCase str w {
            a++;
            } a++ a System.out.println(a) System.out.println System.out System System.out a String[] args args public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String w = in.next();
        int a = 0;
        while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        }
        System.out.println(a);
    }
} public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String w = in.next();
        int a = 0;
        while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        }
        System.out.println(a);
    }
} Main
import java.util.Scanner;                                                   

public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String w = in.next();
        int a = 0;
        while(in.hasNext()){
            String str = in.next();
            if(str.equals("END_OF_TEXT")){
                break;
            }else if(str.equalsIgnoreCase(w)){
            a++;
            }
        }
        System.out.println(a);
    }
}