import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String t[];
		int count = 0;
		boolean flag=true;
		try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String t[];
		int count = 0;
		boolean flag=true;
		try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
} Main public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String t[];
		int count = 0;
		boolean flag=true;
		try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		}

	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String t[];
		int count = 0;
		boolean flag=true;
		try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		}

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String t[]; t int count = 0; count 0 boolean flag=true; flag true try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} String w = br.readLine(); w br.readLine() br.readLine br while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			} flag {
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			} t = br.readLine().split(" ") t br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				} String string t {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				} {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				} if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					} string.equals("END_OF_TEXT") string.equals string "END_OF_TEXT" {
						flag = false;
						break;
					} flag = false flag false break; if(string.equalsIgnoreCase(w)){
						count++;
					} string.equalsIgnoreCase(w) string.equalsIgnoreCase string w {
						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) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String t[];
		int count = 0;
		boolean flag=true;
		try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
} public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String t[];
		int count = 0;
		boolean flag=true;
		try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String t[];
		int count = 0;
		boolean flag=true;
		try {
			String w = br.readLine();
			while(flag){
				t = br.readLine().split(" ");
				for (String string : t) {
					if(string.equals("END_OF_TEXT")){
						flag = false;
						break;
					}
					if(string.equalsIgnoreCase(w)){
						count++;
					}
				}
			}
			System.out.println(count);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}