import java.util.*;

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

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