import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String line1 = br.readLine();
		while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		}
		System.out.println(count);
	}
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String line1 = br.readLine();
		while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String line1 = br.readLine();
		while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		}
		System.out.println(count);
	} main { 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String line1 = br.readLine();
		while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		}
		System.out.println(count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int count = 0; count 0 String line1 = br.readLine(); line1 br.readLine() br.readLine br while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		} true {

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		} String line = br.readLine(); line br.readLine() br.readLine br if ("END_OF_TEXT".equals(line)) {break;} "END_OF_TEXT".equals(line) "END_OF_TEXT".equals "END_OF_TEXT" line {break;} break; String[] str = line.split(" "); str line.split(" ") line.split line " " for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			} int i=0; int i=0; i 0 i<str.length i str.length str str.length i++ i++ i {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			} {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			} if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				} str[i].equalsIgnoreCase(line1) str[i].equalsIgnoreCase str[i] str i line1 {
					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) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String line1 = br.readLine();
		while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		}
		System.out.println(count);
	}
} public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String line1 = br.readLine();
		while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		}
		System.out.println(count);
	}
} Main
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) throws IOException{ 
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = 0;
		String line1 = br.readLine();
		while(true){

			String line = br.readLine();
			if ("END_OF_TEXT".equals(line)) {break;}
			String[] str = line.split(" ");
			for (int i=0; i<str.length ; i++ ) {
				if (str[i].equalsIgnoreCase(line1)) {
					count++;	
				}
			}
		}
		System.out.println(count);
	}
}