import java.util.*;
public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	int count = 0;
    	String w = sc.next();
    	w = w.toLowerCase();
    	while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	}
    	System.out.println(count);
    }
} import java.util.*; util.* java public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	int count = 0;
    	String w = sc.next();
    	w = w.toLowerCase();
    	while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	}
    	System.out.println(count);
    }
} Main public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) throws Exception {
    	int i, j, k;
    	int count = 0;
    	String w = sc.next();
    	w = w.toLowerCase();
    	while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	}
    	System.out.println(count);
    } main {
    	int i, j, k;
    	int count = 0;
    	String w = sc.next();
    	w = w.toLowerCase();
    	while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	}
    	System.out.println(count);
    } int i i j j k; k int count = 0; count 0 String w = sc.next(); w sc.next() sc.next sc w = w.toLowerCase() w w.toLowerCase() w.toLowerCase w while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	} true {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	} String t = sc.next(); t sc.next() sc.next sc if(t.contains("END_OF_TEXT")) break; t.contains("END_OF_TEXT") t.contains t "END_OF_TEXT" break; t = t.toLowerCase() t t.toLowerCase() t.toLowerCase t if(t.equals(w)) count++; t.equals(w) t.equals t w count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	int count = 0;
    	String w = sc.next();
    	w = w.toLowerCase();
    	while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	}
    	System.out.println(count);
    }
} public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	int count = 0;
    	String w = sc.next();
    	w = w.toLowerCase();
    	while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	}
    	System.out.println(count);
    }
} Main
import java.util.*;
public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	int count = 0;
    	String w = sc.next();
    	w = w.toLowerCase();
    	while(true) {
    		String t = sc.next();
    		if(t.contains("END_OF_TEXT")) break;
    		t = t.toLowerCase();
    		if(t.equals(w)) count++;
    	}
    	System.out.println(count);
    }
}
