import java.io.*;
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);
    String input=scan.next();
    int count=0;
    while(true){
      String str=scan.next();
      if(str.equals("END_OF_TEXT"))break;
      if(input.equalsIgnoreCase(str)){
        count++;
      }
    }
    System.out.println(count);
  }
}
 import java.io.*; io.* java import java.util.*; util.* java import java.lang.*; lang.* java class Main{
  public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);
    String input=scan.next();
    int count=0;
    while(true){
      String str=scan.next();
      if(str.equals("END_OF_TEXT"))break;
      if(input.equalsIgnoreCase(str)){
        count++;
      }
    }
    System.out.println(count);
  }
} Main public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);
    String input=scan.next();
    int count=0;
    while(true){
      String str=scan.next();
      if(str.equals("END_OF_TEXT"))break;
      if(input.equalsIgnoreCase(str)){
        count++;
      }
    }
    System.out.println(count);
  } main {
    Scanner scan=new Scanner(System.in);
    String input=scan.next();
    int count=0;
    while(true){
      String str=scan.next();
      if(str.equals("END_OF_TEXT"))break;
      if(input.equalsIgnoreCase(str)){
        count++;
      }
    }
    System.out.println(count);
  } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String input=scan.next(); input scan.next() scan.next scan int count=0; count 0 while(true){
      String str=scan.next();
      if(str.equals("END_OF_TEXT"))break;
      if(input.equalsIgnoreCase(str)){
        count++;
      }
    } true {
      String str=scan.next();
      if(str.equals("END_OF_TEXT"))break;
      if(input.equalsIgnoreCase(str)){
        count++;
      }
    } String str=scan.next(); str scan.next() scan.next scan if(str.equals("END_OF_TEXT"))break; str.equals("END_OF_TEXT") str.equals str "END_OF_TEXT" break; if(input.equalsIgnoreCase(str)){
        count++;
      } input.equalsIgnoreCase(str) input.equalsIgnoreCase input str {
        count++;
      } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.io.*;
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) throws IOException{
    Scanner scan=new Scanner(System.in);
    String input=scan.next();
    int count=0;
    while(true){
      String str=scan.next();
      if(str.equals("END_OF_TEXT"))break;
      if(input.equalsIgnoreCase(str)){
        count++;
      }
    }
    System.out.println(count);
  }
}

