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

public class Main {

	public static void main(String[] args) {

		int count = 0;
		String check;
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		}
	}

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

	public static void main(String[] args) {

		int count = 0;
		String check;
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		}
	}

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

		int count = 0;
		String check;
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		}
	} main {

		int count = 0;
		String check;
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		}
	} int count = 0; count 0 String check; check Scanner sc = null; sc null try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		} {
			sc.close();
		} sc.close() sc.close sc {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} sc = new Scanner(System.in) sc new Scanner(System.in) check = sc.next() check sc.next() sc.next sc ArrayList<String> textList = new ArrayList<String>(); textList new ArrayList<String>() while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			} sc.hasNext() sc.hasNext sc {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			} String word = sc.next(); word sc.next() sc.next sc if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				} !word.equals("END_OF_TEXT") word.equals("END_OF_TEXT") word.equals word "END_OF_TEXT" {
					word = word.toLowerCase();

					textList.add(word);
				} word = word.toLowerCase() word word.toLowerCase() word.toLowerCase word textList.add(word) textList.add textList word {
					break;
				} break; for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			} int i = 0; int i = 0; i 0 i < textList.size() i textList.size() textList.size textList i++ i++ i {

				if (textList.get(i).equals(check)) {
					count++;
				}
			} {

				if (textList.get(i).equals(check)) {
					count++;
				}
			} if (textList.get(i).equals(check)) {
					count++;
				} textList.get(i).equals(check) textList.get(i).equals textList.get(i) textList.get textList i 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) {

		int count = 0;
		String check;
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		}
	}

} public class Main {

	public static void main(String[] args) {

		int count = 0;
		String check;
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		}
	}

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int count = 0;
		String check;
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);

			check = sc.next();

			//??????????????¬????????§??????????´?
			ArrayList<String> textList = new ArrayList<String>();
			while (sc.hasNext()) {
				String word = sc.next();

				//??????????????????
				if (!word.equals("END_OF_TEXT")) {
					word = word.toLowerCase();

					textList.add(word);
				} else {
					break;
				}
			}
			//??????????????????????????????????????§??????
			for (int i = 0; i < textList.size(); i++) {

				if (textList.get(i).equals(check)) {
					count++;
				}
			}
			System.out.println(count);

		} finally {
			sc.close();
		}
	}

}