import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    } main {

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String w = sc.next().toLowerCase(); w sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc int cnt = 0; cnt 0 while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        } true {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        } String s = sc.next(); s sc.next() sc.next sc if (s.equals("END_OF_TEXT"))
                break; s.equals("END_OF_TEXT") s.equals s "END_OF_TEXT" break; if (s.toLowerCase().equals(w))
                cnt++; s.toLowerCase().equals(w) s.toLowerCase().equals s.toLowerCase() s.toLowerCase s w cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String w = sc.next().toLowerCase();

        int cnt = 0;
        while (true) {
            String s = sc.next();
            
            if (s.equals("END_OF_TEXT"))
                break;
            
            if (s.toLowerCase().equals(w))
                cnt++;
        }
        System.out.println(cnt);
    }
}

