import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int count=0;
        String word=sc.nextLine();
        word=word.toLowerCase();
        String sent="";
        while(sc.hasNext()){
            sent=sc.next();
            if(sent.equals("END_OF_TEXT")) break;
            sent=sent.toLowerCase();
            if(sent.equals(word))
                count++;
        }
        System.out.println(count);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int count=0;
        String word=sc.nextLine();
        word=word.toLowerCase();
        String sent="";
        while(sc.hasNext()){
            sent=sc.next();
            if(sent.equals("END_OF_TEXT")) break;
            sent=sent.toLowerCase();
            if(sent.equals(word))
                count++;
        }
        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int count=0;
        String word=sc.nextLine();
        word=word.toLowerCase();
        String sent="";
        while(sc.hasNext()){
            sent=sc.next();
            if(sent.equals("END_OF_TEXT")) break;
            sent=sent.toLowerCase();
            if(sent.equals(word))
                count++;
        }
        System.out.println(count);
    } main {
        Scanner sc=new Scanner(System.in);
        int count=0;
        String word=sc.nextLine();
        word=word.toLowerCase();
        String sent="";
        while(sc.hasNext()){
            sent=sc.next();
            if(sent.equals("END_OF_TEXT")) break;
            sent=sent.toLowerCase();
            if(sent.equals(word))
                count++;
        }
        System.out.println(count);
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int count=0; count 0 String word=sc.nextLine(); word sc.nextLine() sc.nextLine sc word=word.toLowerCase() word word.toLowerCase() word.toLowerCase word String sent=""; sent "" while(sc.hasNext()){
            sent=sc.next();
            if(sent.equals("END_OF_TEXT")) break;
            sent=sent.toLowerCase();
            if(sent.equals(word))
                count++;
        } sc.hasNext() sc.hasNext sc {
            sent=sc.next();
            if(sent.equals("END_OF_TEXT")) break;
            sent=sent.toLowerCase();
            if(sent.equals(word))
                count++;
        } sent=sc.next() sent sc.next() sc.next sc if(sent.equals("END_OF_TEXT")) break; sent.equals("END_OF_TEXT") sent.equals sent "END_OF_TEXT" break; sent=sent.toLowerCase() sent sent.toLowerCase() sent.toLowerCase sent if(sent.equals(word))
                count++; sent.equals(word) sent.equals sent word count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int count=0;
        String word=sc.nextLine();
        word=word.toLowerCase();
        String sent="";
        while(sc.hasNext()){
            sent=sc.next();
            if(sent.equals("END_OF_TEXT")) break;
            sent=sent.toLowerCase();
            if(sent.equals(word))
                count++;
        }
        System.out.println(count);
    }
}
