import java.util.Scanner;

public class Main {
	static int list[] = new int[26];
	public static void main(String[] args) {
		int cnt = 0;
		Scanner scan = new Scanner(System.in);
		String W = scan.nextLine();
		try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	static int list[] = new int[26];
	public static void main(String[] args) {
		int cnt = 0;
		Scanner scan = new Scanner(System.in);
		String W = scan.nextLine();
		try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		}
	}
} Main static int list[] = new int[26]; list new int[26] 26 public static void main(String[] args) {
		int cnt = 0;
		Scanner scan = new Scanner(System.in);
		String W = scan.nextLine();
		try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		}
	} main {
		int cnt = 0;
		Scanner scan = new Scanner(System.in);
		String W = scan.nextLine();
		try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		}
	} int cnt = 0; cnt 0 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String W = scan.nextLine(); W scan.nextLine() scan.nextLine scan try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		} catch(IllegalStateException e){
			System.out.println(cnt);
		} IllegalStateException e {
			System.out.println(cnt);
		} System.out.println(cnt) System.out.println System.out System System.out cnt {
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		} while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			} scan.hasNext() scan.hasNext scan {
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			} String T = scan.next(); T scan.next() scan.next scan if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				} T.equals("END_OF_TEXT") T.equals T "END_OF_TEXT" {
					scan.close();
				} scan.close() scan.close scan if(W.equalsIgnoreCase(T)){
					cnt++;
				} W.equalsIgnoreCase(T) W.equalsIgnoreCase W T {
					cnt++;
				} cnt++ cnt String[] args args public class Main {
	static int list[] = new int[26];
	public static void main(String[] args) {
		int cnt = 0;
		Scanner scan = new Scanner(System.in);
		String W = scan.nextLine();
		try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		}
	}
} public class Main {
	static int list[] = new int[26];
	public static void main(String[] args) {
		int cnt = 0;
		Scanner scan = new Scanner(System.in);
		String W = scan.nextLine();
		try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	static int list[] = new int[26];
	public static void main(String[] args) {
		int cnt = 0;
		Scanner scan = new Scanner(System.in);
		String W = scan.nextLine();
		try{
			while(scan.hasNext()){
				String T = scan.next();
				if(T.equals("END_OF_TEXT")){
					scan.close();
				}else if(W.equalsIgnoreCase(T)){
					cnt++;
				}
			}
		}catch(IllegalStateException e){
			System.out.println(cnt);
		}
	}
}