import java.io.*;
import java.util.Arrays;
class Main{
    public static void main(String[] args) throws IOException {
        int cnt,i; 
        String line,chr;
        String[] str = new String[1000];
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        chr = in.readLine(); cnt=0;
        while((line=in.readLine()) != null){
            if("END_OF_TEXT".equals(line)) break;
            str = line.split(" ",-1);
            for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            }
        }
        System.out.println(cnt);
        System.out.flush();
    }
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util class Main{
    public static void main(String[] args) throws IOException {
        int cnt,i; 
        String line,chr;
        String[] str = new String[1000];
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        chr = in.readLine(); cnt=0;
        while((line=in.readLine()) != null){
            if("END_OF_TEXT".equals(line)) break;
            str = line.split(" ",-1);
            for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            }
        }
        System.out.println(cnt);
        System.out.flush();
    }
} Main public static void main(String[] args) throws IOException {
        int cnt,i; 
        String line,chr;
        String[] str = new String[1000];
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        chr = in.readLine(); cnt=0;
        while((line=in.readLine()) != null){
            if("END_OF_TEXT".equals(line)) break;
            str = line.split(" ",-1);
            for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            }
        }
        System.out.println(cnt);
        System.out.flush();
    } main {
        int cnt,i; 
        String line,chr;
        String[] str = new String[1000];
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        chr = in.readLine(); cnt=0;
        while((line=in.readLine()) != null){
            if("END_OF_TEXT".equals(line)) break;
            str = line.split(" ",-1);
            for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            }
        }
        System.out.println(cnt);
        System.out.flush();
    } int cnt cnt i; i String line line chr; chr String[] str = new String[1000]; str new String[1000] 1000 BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) chr = in.readLine() chr in.readLine() in.readLine in cnt=0 cnt 0 while((line=in.readLine()) != null){
            if("END_OF_TEXT".equals(line)) break;
            str = line.split(" ",-1);
            for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            }
        } (line=in.readLine()) != null (line=in.readLine()) line in.readLine() in.readLine in null {
            if("END_OF_TEXT".equals(line)) break;
            str = line.split(" ",-1);
            for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            }
        } if("END_OF_TEXT".equals(line)) break; "END_OF_TEXT".equals(line) "END_OF_TEXT".equals "END_OF_TEXT" line break; str = line.split(" ",-1) str line.split(" ",-1) line.split line " " -1 1 for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            } i=0; i=0 i 0 i<str.length i str.length str str.length i++ i++ i {
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            } {
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            } if(str[i].equalsIgnoreCase(chr)) cnt+=1; str[i].equalsIgnoreCase(chr) str[i].equalsIgnoreCase str[i] str i chr cnt+=1 cnt 1 System.out.println(cnt) System.out.println System.out System System.out cnt System.out.flush() System.out.flush System.out System System.out String[] args args
import java.io.*;
import java.util.Arrays;
class Main{
    public static void main(String[] args) throws IOException {
        int cnt,i; 
        String line,chr;
        String[] str = new String[1000];
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        chr = in.readLine(); cnt=0;
        while((line=in.readLine()) != null){
            if("END_OF_TEXT".equals(line)) break;
            str = line.split(" ",-1);
            for(i=0;i<str.length;i++){
                if(str[i].equalsIgnoreCase(chr)) cnt+=1;
            }
        }
        System.out.println(cnt);
        System.out.flush();
    }
}