import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String [] args) {
		
		Scanner scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	}
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util public class Main {
	public static void main(String [] args) {
		
		Scanner scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	}
} Main public static void main(String [] args) {
		
		Scanner scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	} main {
		
		Scanner scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) ArrayList<String> charcter = new ArrayList<String>(); charcter new ArrayList<String>() final String END = "END_OF_TEXT"; END "END_OF_TEXT" int count = 0; count 0 int i = 0; i 0 String sentence; sentence String word = scan.nextLine(); word scan.nextLine() scan.nextLine scan do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext()); scan.hasNext() scan.hasNext scan {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} sentence = scan.next() sentence scan.next() scan.next scan charcter.add(sentence) charcter.add charcter sentence if (sentence.equals(END)) break; sentence.equals(END) sentence.equals sentence END break; if ( sentence.equalsIgnoreCase(word)) count++; sentence.equalsIgnoreCase(word) sentence.equalsIgnoreCase sentence word 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 scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	}
} public class Main {
	public static void main(String [] args) {
		
		Scanner scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	}
} Main
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	public static void main(String [] args) {
		
		Scanner scan = new Scanner(System.in);
		ArrayList<String> charcter = new ArrayList<String>();
		final String END = "END_OF_TEXT";
		int count = 0;
		int i = 0;
		String sentence;
		
		String word = scan.nextLine();
		
		do {
			
			sentence = scan.next();
			charcter.add(sentence);
			
			if (sentence.equals(END)) break;
			
			if ( sentence.equalsIgnoreCase(word)) count++;
			
		} while(scan.hasNext());
		
		System.out.println(count);
		
	}
}
