

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		String sentence = "";
		String word = in.next();
		int count = 0;

		while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		}

		System.out.println(count);

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		String sentence = "";
		String word = in.next();
		int count = 0;

		while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		}

		System.out.println(count);

	}
} Main public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		String sentence = "";
		String word = in.next();
		int count = 0;

		while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		}

		System.out.println(count);

	} main {

		Scanner in = new Scanner(System.in);
		String sentence = "";
		String word = in.next();
		int count = 0;

		while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		}

		System.out.println(count);

	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String sentence = ""; sentence "" String word = in.next(); word in.next() in.next in int count = 0; count 0 while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		} !(sentence.equals("END_OF_TEXT")) (sentence.equals("END_OF_TEXT")) sentence.equals sentence "END_OF_TEXT" {

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		} sentence = in.next() sentence in.next() in.next in if(word.equalsIgnoreCase(sentence)){

				count ++;

			} word.equalsIgnoreCase(sentence) word.equalsIgnoreCase word sentence {

				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 in = new Scanner(System.in);
		String sentence = "";
		String word = in.next();
		int count = 0;

		while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		}

		System.out.println(count);

	}
} public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		String sentence = "";
		String word = in.next();
		int count = 0;

		while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		}

		System.out.println(count);

	}
} Main


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		String sentence = "";
		String word = in.next();
		int count = 0;

		while(!(sentence.equals("END_OF_TEXT"))){

			sentence = in.next();

			if(word.equalsIgnoreCase(sentence)){

				count ++;

			}
		}

		System.out.println(count);

	}
}