

import java.io.IOException;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) throws IOException {
		/*
		 * ?????? ???.length < 10 ?????? ??´.length < 1000
		 *
		 * T.contains " " or Enter Ti
		 *
		 * All Ti -> T.contains cnt?
		 *
		 * Example) input- W : computer
		 *
		 * T1: Nurtures computer scientists and highly-skilled computerengineers
		 * T2: who will create and exploit "knowledge" for the newera.
		 * T3: Provides an outstanding computer environment.
		 * T4: END_OF_TEXT if(t4.equl("END_OF_TEXT"))break;
		 *
		 * output- 3
		 */

		Scanner sc = new Scanner(System.in);

		// sample input
		final String infoW = sc.next();
		// Count variable declear
		int cnt = 0;
		// while section

		while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) throws IOException {
		/*
		 * ?????? ???.length < 10 ?????? ??´.length < 1000
		 *
		 * T.contains " " or Enter Ti
		 *
		 * All Ti -> T.contains cnt?
		 *
		 * Example) input- W : computer
		 *
		 * T1: Nurtures computer scientists and highly-skilled computerengineers
		 * T2: who will create and exploit "knowledge" for the newera.
		 * T3: Provides an outstanding computer environment.
		 * T4: END_OF_TEXT if(t4.equl("END_OF_TEXT"))break;
		 *
		 * output- 3
		 */

		Scanner sc = new Scanner(System.in);

		// sample input
		final String infoW = sc.next();
		// Count variable declear
		int cnt = 0;
		// while section

		while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} Main public static void main(String[] args) throws IOException {
		/*
		 * ?????? ???.length < 10 ?????? ??´.length < 1000
		 *
		 * T.contains " " or Enter Ti
		 *
		 * All Ti -> T.contains cnt?
		 *
		 * Example) input- W : computer
		 *
		 * T1: Nurtures computer scientists and highly-skilled computerengineers
		 * T2: who will create and exploit "knowledge" for the newera.
		 * T3: Provides an outstanding computer environment.
		 * T4: END_OF_TEXT if(t4.equl("END_OF_TEXT"))break;
		 *
		 * output- 3
		 */

		Scanner sc = new Scanner(System.in);

		// sample input
		final String infoW = sc.next();
		// Count variable declear
		int cnt = 0;
		// while section

		while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} main {
		/*
		 * ?????? ???.length < 10 ?????? ??´.length < 1000
		 *
		 * T.contains " " or Enter Ti
		 *
		 * All Ti -> T.contains cnt?
		 *
		 * Example) input- W : computer
		 *
		 * T1: Nurtures computer scientists and highly-skilled computerengineers
		 * T2: who will create and exploit "knowledge" for the newera.
		 * T3: Provides an outstanding computer environment.
		 * T4: END_OF_TEXT if(t4.equl("END_OF_TEXT"))break;
		 *
		 * output- 3
		 */

		Scanner sc = new Scanner(System.in);

		// sample input
		final String infoW = sc.next();
		// Count variable declear
		int cnt = 0;
		// while section

		while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String infoW = sc.next(); infoW sc.next() sc.next sc int cnt = 0; cnt 0 while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		} true {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		} final String  strT = sc.next(); strT sc.next() sc.next sc if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			} "END_OF_TEXT".equals(strT) "END_OF_TEXT".equals "END_OF_TEXT" strT {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} break; if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			} infoW.equalsIgnoreCase(strT) infoW.equalsIgnoreCase infoW strT {
				cnt++;
			} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main{

	public static void main(String[] args) throws IOException {
		/*
		 * ?????? ???.length < 10 ?????? ??´.length < 1000
		 *
		 * T.contains " " or Enter Ti
		 *
		 * All Ti -> T.contains cnt?
		 *
		 * Example) input- W : computer
		 *
		 * T1: Nurtures computer scientists and highly-skilled computerengineers
		 * T2: who will create and exploit "knowledge" for the newera.
		 * T3: Provides an outstanding computer environment.
		 * T4: END_OF_TEXT if(t4.equl("END_OF_TEXT"))break;
		 *
		 * output- 3
		 */

		Scanner sc = new Scanner(System.in);

		// sample input
		final String infoW = sc.next();
		// Count variable declear
		int cnt = 0;
		// while section

		while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} public class Main{

	public static void main(String[] args) throws IOException {
		/*
		 * ?????? ???.length < 10 ?????? ??´.length < 1000
		 *
		 * T.contains " " or Enter Ti
		 *
		 * All Ti -> T.contains cnt?
		 *
		 * Example) input- W : computer
		 *
		 * T1: Nurtures computer scientists and highly-skilled computerengineers
		 * T2: who will create and exploit "knowledge" for the newera.
		 * T3: Provides an outstanding computer environment.
		 * T4: END_OF_TEXT if(t4.equl("END_OF_TEXT"))break;
		 *
		 * output- 3
		 */

		Scanner sc = new Scanner(System.in);

		// sample input
		final String infoW = sc.next();
		// Count variable declear
		int cnt = 0;
		// while section

		while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} Main


import java.io.IOException;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) throws IOException {
		/*
		 * ?????? ???.length < 10 ?????? ??´.length < 1000
		 *
		 * T.contains " " or Enter Ti
		 *
		 * All Ti -> T.contains cnt?
		 *
		 * Example) input- W : computer
		 *
		 * T1: Nurtures computer scientists and highly-skilled computerengineers
		 * T2: who will create and exploit "knowledge" for the newera.
		 * T3: Provides an outstanding computer environment.
		 * T4: END_OF_TEXT if(t4.equl("END_OF_TEXT"))break;
		 *
		 * output- 3
		 */

		Scanner sc = new Scanner(System.in);

		// sample input
		final String infoW = sc.next();
		// Count variable declear
		int cnt = 0;
		// while section

		while (true) {
			final String  strT = sc.next();
			// break condition
			if ("END_OF_TEXT".equals(strT)) {
				break;
				// equlas() ?°?????????¨??§??????????????\
				// equalsignorecase() ?°?????????¨??§??????????????\?????????
				// ????????????????????????????????????
			} else if (infoW.equalsIgnoreCase(strT)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}