import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String target=scan.next();
        String s;
        int ans=0;
        while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
        scan.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String target=scan.next();
        String s;
        int ans=0;
        while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
        scan.close();
    }
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String target=scan.next();
        String s;
        int ans=0;
        while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
        scan.close();
    } main {
        Scanner scan=new Scanner(System.in);
        String target=scan.next();
        String s;
        int ans=0;
        while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
        scan.close();
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String target=scan.next(); target scan.next() scan.next scan String s; s int ans=0; ans 0 while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        } true {
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        } s=scan.next() s scan.next() scan.next scan if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            } s.equals("END_OF_TEXT") s.equals s "END_OF_TEXT" {
                break;
            } break; {
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            } if(s.equalsIgnoreCase(target)){
                    ans++;
                } s.equalsIgnoreCase(target) s.equalsIgnoreCase s target {
                    ans++;
                } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans scan.close() scan.close scan String[] args args public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String target=scan.next();
        String s;
        int ans=0;
        while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
        scan.close();
    }
} public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String target=scan.next();
        String s;
        int ans=0;
        while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
        scan.close();
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String target=scan.next();
        String s;
        int ans=0;
        while(true){
            s=scan.next();
            if(s.equals("END_OF_TEXT")){
                break;
            }
            else{
                if(s.equalsIgnoreCase(target)){
                    ans++;
                }
            }
        }
        System.out.println(ans);
        scan.close();
    }
}