
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String strCheck = sc.nextLine();

		Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE);


		int Count = 0;
		while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		}
		System.out.println(Count);
	}
} import java.util.Scanner; Scanner java.util import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String strCheck = sc.nextLine();

		Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE);


		int Count = 0;
		while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		}
		System.out.println(Count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String strCheck = sc.nextLine();

		Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE);


		int Count = 0;
		while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		}
		System.out.println(Count);
	} main {
		Scanner sc = new Scanner(System.in);
		String strCheck = sc.nextLine();

		Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE);


		int Count = 0;
		while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		}
		System.out.println(Count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String strCheck = sc.nextLine(); strCheck sc.nextLine() sc.nextLine sc Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE); p Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE) Pattern.compile Pattern strCheck Pattern.CASE_INSENSITIVE Pattern Pattern.CASE_INSENSITIVE int Count = 0; Count 0 while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		} sc.hasNext() sc.hasNext sc {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		} String strS = sc.next(); strS sc.next() sc.next sc Matcher m = p.matcher(strS); m p.matcher(strS) p.matcher p strS if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			} m.matches() m.matches m {
				//System.out.println("????????????????????????");
				Count++;
			} Count++ Count if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			} strS.equals("END_OF_TEXT") strS.equals strS "END_OF_TEXT" {
				//System.out.println("??????????????????");
				break;
			} break; 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 sc = new Scanner(System.in);
		String strCheck = sc.nextLine();

		Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE);


		int Count = 0;
		while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		}
		System.out.println(Count);
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String strCheck = sc.nextLine();

		Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE);


		int Count = 0;
		while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		}
		System.out.println(Count);
	}
} Main

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String strCheck = sc.nextLine();

		Pattern p = Pattern.compile(strCheck, Pattern.CASE_INSENSITIVE);


		int Count = 0;
		while(sc.hasNext()) {

			String strS = sc.next();
			Matcher m = p.matcher(strS);

			if(m.matches()) {
				//System.out.println("????????????????????????");
				Count++;
			}
			if(strS.equals("END_OF_TEXT")) {
				//System.out.println("??????????????????");
				break;
			}
		}
		System.out.println(Count);
	}
}