import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String w = br.readLine();
        int sum = 0;
        while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String w = br.readLine();
        int sum = 0;
        while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String w = br.readLine();
        int sum = 0;
        while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String w = br.readLine();
        int sum = 0;
        while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String w = br.readLine(); w br.readLine() br.readLine br int sum = 0; sum 0 while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        } true {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        } String line = br.readLine(); line br.readLine() br.readLine br if (line.equals("END_OF_TEXT")) {
                break;
            } line.equals("END_OF_TEXT") line.equals line "END_OF_TEXT" {
                break;
            } break; line = line.toLowerCase() line line.toLowerCase() line.toLowerCase line String[] lines=line.split(" "); lines line.split(" ") line.split line " " for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            } String s lines {
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            } {
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            } if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                } s.contains(w)&&s.length()==w.length() s.contains(w) s.contains s w s.length()==w.length() s.length() s.length s w.length() w.length w {
                    sum++;
                } sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String w = br.readLine();
        int sum = 0;
        while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String w = br.readLine();
        int sum = 0;
        while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String w = br.readLine();
        int sum = 0;
        while (true) {
            String line = br.readLine();
            if (line.equals("END_OF_TEXT")) {
                break;
            }
            line = line.toLowerCase();
            String[] lines=line.split(" ");
            for(String s:lines){
                if(s.contains(w)&&s.length()==w.length()){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
}