import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        int count = 0;
        while(true){
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        int count = 0;
        while(true){
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        int count = 0;
        while(true){
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        int count = 0;
        while(true){
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String w = sc.next(); w sc.next() sc.next sc int count = 0; count 0 while(true){
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        } true {
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        } String t = sc.next(); t sc.next() sc.next sc if(t.equals("END_OF_TEXT")){
            	break;
            } t.equals("END_OF_TEXT") t.equals t "END_OF_TEXT" {
            	break;
            } break; if(t.equalsIgnoreCase(w)){
            	count++;
            } t.equalsIgnoreCase(w) t.equalsIgnoreCase t w {
            	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 w = sc.next();
        int count = 0;
        while(true){
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        }
        System.out.println(count);
    }
} public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        int count = 0;
        while(true){
        	String t = sc.next();
            if(t.equals("END_OF_TEXT")){
            	break;
            }
            if(t.equalsIgnoreCase(w)){
            	count++;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;

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