import java.util.Scanner;

public class Main {

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

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

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

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

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int count=0;
        String w,t;
        w=scan.next();
        w=w.toLowerCase();
        while(true) {
        	t=scan.next();
        	if(t.equals("END_OF_TEXT")) {
        		break;
        	}
        	t=t.toLowerCase();
        	if(t.equals(w)) {
        		count++;
        	}
        }
        System.out.println(count);
    }
}
