import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	int cnt=0;
	String pattern;
	
	String first = in.nextLine();
	while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	}
	System.out.println(cnt);
    }
}
	    
	
 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	int cnt=0;
	String pattern;
	
	String first = in.nextLine();
	while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	}
	System.out.println(cnt);
    }
} Main public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	int cnt=0;
	String pattern;
	
	String first = in.nextLine();
	while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	}
	System.out.println(cnt);
    } main {
	Scanner in = new Scanner(System.in);
	int cnt=0;
	String pattern;
	
	String first = in.nextLine();
	while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	}
	System.out.println(cnt);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int cnt=0; cnt 0 String pattern; pattern String first = in.nextLine(); first in.nextLine() in.nextLine in while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	} in.hasNext() in.hasNext in {
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	} pattern = in.next() pattern in.next() in.next in if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break; pattern.equalsIgnoreCase(first) pattern.equalsIgnoreCase pattern first cnt++ cnt if(pattern.equals("END_OF_TEXT"))break; pattern.equals("END_OF_TEXT") pattern.equals pattern "END_OF_TEXT" break; 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){
	Scanner in = new Scanner(System.in);
	int cnt=0;
	String pattern;
	
	String first = in.nextLine();
	while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	}
	System.out.println(cnt);
    }
} public class Main{
    public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	int cnt=0;
	String pattern;
	
	String first = in.nextLine();
	while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	}
	System.out.println(cnt);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner in = new Scanner(System.in);
	int cnt=0;
	String pattern;
	
	String first = in.nextLine();
	while(in.hasNext()){
	    pattern = in.next();
	    if(pattern.equalsIgnoreCase(first))cnt++;
	    else if(pattern.equals("END_OF_TEXT"))break;
	}
	System.out.println(cnt);
    }
}
	    
	

