import java.util.Scanner;

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

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