import java.io.IOException;
import java.util.Scanner;

class Main{
    private static final Scanner sc = new Scanner(System.in);
    public static void main(String[] Args) throws IOException{
        final String w = sc.next();
        int ans = 0;
        while(true){
            final String t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(w.compareToIgnoreCase(t)==0) ans++;
        }
        System.out.println(ans);
    }
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util class Main{
    private static final Scanner sc = new Scanner(System.in);
    public static void main(String[] Args) throws IOException{
        final String w = sc.next();
        int ans = 0;
        while(true){
            final String t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(w.compareToIgnoreCase(t)==0) ans++;
        }
        System.out.println(ans);
    }
} Main private static final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] Args) throws IOException{
        final String w = sc.next();
        int ans = 0;
        while(true){
            final String t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(w.compareToIgnoreCase(t)==0) ans++;
        }
        System.out.println(ans);
    } main {
        final String w = sc.next();
        int ans = 0;
        while(true){
            final String t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(w.compareToIgnoreCase(t)==0) ans++;
        }
        System.out.println(ans);
    } final String w = sc.next(); w sc.next() sc.next sc int ans = 0; ans 0 while(true){
            final String t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(w.compareToIgnoreCase(t)==0) ans++;
        } true {
            final String t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(w.compareToIgnoreCase(t)==0) ans++;
        } final String t = sc.next(); t sc.next() sc.next sc if(t.equals("END_OF_TEXT")) break; t.equals("END_OF_TEXT") t.equals t "END_OF_TEXT" break; if(w.compareToIgnoreCase(t)==0) ans++; w.compareToIgnoreCase(t)==0 w.compareToIgnoreCase(t) w.compareToIgnoreCase w t 0 ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] Args Args
import java.io.IOException;
import java.util.Scanner;

class Main{
    private static final Scanner sc = new Scanner(System.in);
    public static void main(String[] Args) throws IOException{
        final String w = sc.next();
        int ans = 0;
        while(true){
            final String t = sc.next();
            if(t.equals("END_OF_TEXT")) break;
            if(w.compareToIgnoreCase(t)==0) ans++;
        }
        System.out.println(ans);
    }
}