import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    String w,t,n;
    int co=0;
        n = "END_OF_TEXT";
           w = s.next();
           while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           }
           System.out.println(co);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    String w,t,n;
    int co=0;
        n = "END_OF_TEXT";
           w = s.next();
           while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           }
           System.out.println(co);
    }
} Main public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    String w,t,n;
    int co=0;
        n = "END_OF_TEXT";
           w = s.next();
           while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           }
           System.out.println(co);
    } main {
    Scanner s = new Scanner(System.in);
    String w,t,n;
    int co=0;
        n = "END_OF_TEXT";
           w = s.next();
           while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           }
           System.out.println(co);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) String w w t t n; n int co=0; co 0 n = "END_OF_TEXT" n "END_OF_TEXT" w = s.next() w s.next() s.next s while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           } true {
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           } t = s.next() t s.next() s.next s if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break; t.equalsIgnoreCase(w) t.equalsIgnoreCase t w co++ co if(t.equals(n))break; t.equals(n) t.equals t n break; System.out.println(co) System.out.println System.out System System.out co String[] args args public class Main{
    public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    String w,t,n;
    int co=0;
        n = "END_OF_TEXT";
           w = s.next();
           while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           }
           System.out.println(co);
    }
} public class Main{
    public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    String w,t,n;
    int co=0;
        n = "END_OF_TEXT";
           w = s.next();
           while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           }
           System.out.println(co);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    String w,t,n;
    int co=0;
        n = "END_OF_TEXT";
           w = s.next();
           while(true){
               t = s.next();
               if(t.equalsIgnoreCase(w))co++;
               else if(t.equals(n))break;
           }
           System.out.println(co);
    }
}
