import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String W = sc.next().toLowerCase();
    while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    }
    System.out.printf("%d\n", count);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String W = sc.next().toLowerCase();
    while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    }
    System.out.printf("%d\n", count);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String W = sc.next().toLowerCase();
    while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    }
    System.out.printf("%d\n", count);
  } main {
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String W = sc.next().toLowerCase();
    while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    }
    System.out.printf("%d\n", count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 String W = sc.next().toLowerCase(); W sc.next().toLowerCase() sc.next().toLowerCase sc.next() sc.next sc while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    } true {
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    } String s = sc.next(); s sc.next() sc.next sc if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      } s.equals("END_OF_TEXT") s.equals s "END_OF_TEXT" {
        break;
      } break; if(s.toLowerCase().equals(W)){
        count++;
      } s.toLowerCase().equals(W) s.toLowerCase().equals s.toLowerCase() s.toLowerCase s W {
        count++;
      } count++ count System.out.printf("%d\n", count) System.out.printf System.out System System.out "%d\n" count String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String W = sc.next().toLowerCase();
    while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    }
    System.out.printf("%d\n", count);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String W = sc.next().toLowerCase();
    while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    }
    System.out.printf("%d\n", count);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int count = 0;
    String W = sc.next().toLowerCase();
    while(true){
      String s = sc.next();
      if(s.equals("END_OF_TEXT")){
        break;
      }
      else if(s.toLowerCase().equals(W)){
        count++;
      }
    }
    System.out.printf("%d\n", count);
  }
}
