import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N=0;
    String Word =scanner.nextLine();
    String Sentence;

    do{
      Sentence =scanner.next();
      if(Word.equals(Sentence.toLowerCase())){
        N++;
      }
    }while(!(Sentence.equals("END_OF_TEXT")));

    System.out.println(N);


  }
}
 import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N=0;
    String Word =scanner.nextLine();
    String Sentence;

    do{
      Sentence =scanner.next();
      if(Word.equals(Sentence.toLowerCase())){
        N++;
      }
    }while(!(Sentence.equals("END_OF_TEXT")));

    System.out.println(N);


  }
} Main public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N=0;
    String Word =scanner.nextLine();
    String Sentence;

    do{
      Sentence =scanner.next();
      if(Word.equals(Sentence.toLowerCase())){
        N++;
      }
    }while(!(Sentence.equals("END_OF_TEXT")));

    System.out.println(N);


  } main {
    Scanner scanner = new Scanner(System.in);
    int N=0;
    String Word =scanner.nextLine();
    String Sentence;

    do{
      Sentence =scanner.next();
      if(Word.equals(Sentence.toLowerCase())){
        N++;
      }
    }while(!(Sentence.equals("END_OF_TEXT")));

    System.out.println(N);


  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N=0; N 0 String Word =scanner.nextLine(); Word scanner.nextLine() scanner.nextLine scanner String Sentence; Sentence do{
      Sentence =scanner.next();
      if(Word.equals(Sentence.toLowerCase())){
        N++;
      }
    }while(!(Sentence.equals("END_OF_TEXT"))); !(Sentence.equals("END_OF_TEXT")) (Sentence.equals("END_OF_TEXT")) Sentence.equals Sentence "END_OF_TEXT" {
      Sentence =scanner.next();
      if(Word.equals(Sentence.toLowerCase())){
        N++;
      }
    } Sentence =scanner.next() Sentence scanner.next() scanner.next scanner if(Word.equals(Sentence.toLowerCase())){
        N++;
      } Word.equals(Sentence.toLowerCase()) Word.equals Word Sentence.toLowerCase() Sentence.toLowerCase Sentence {
        N++;
      } N++ N System.out.println(N) System.out.println System.out System System.out N String[] args args
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N=0;
    String Word =scanner.nextLine();
    String Sentence;

    do{
      Sentence =scanner.next();
      if(Word.equals(Sentence.toLowerCase())){
        N++;
      }
    }while(!(Sentence.equals("END_OF_TEXT")));

    System.out.println(N);


  }
}

