import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    }
} Main public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    } main {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    } Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) String w; w String t; t int countW; countW w = stdin.next() w stdin.next() stdin.next stdin countW = 0 countW 0 while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        } true {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        } t = stdin.next() t stdin.next() stdin.next stdin if ("END_OF_TEXT".equals(t)) {
                break;
            } "END_OF_TEXT".equals(t) "END_OF_TEXT".equals "END_OF_TEXT" t {
                break;
            } break; if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            } w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t) w.equalsIgnoreCase(t) w.equalsIgnoreCase w t w.equalsIgnoreCase(t) w.equalsIgnoreCase w t {
                countW++;
            } countW++ countW System.out.println(countW) System.out.println System.out System System.out countW stdin.close() stdin.close stdin String[] args args public class Main{
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    }
} public class Main{
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
         
        String w;
        String t;
        int countW;
         
        w = stdin.next();
         
        countW = 0;
        while (true) {
            t = stdin.next();
            if ("END_OF_TEXT".equals(t)) {
                break;
            }
             
            if (w.equalsIgnoreCase(t) || w.equalsIgnoreCase(t)) {
                countW++;
            }
        }
         
        System.out.println(countW);
        
        stdin.close();
    }
}