import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String w = scan.nextLine();
        String t = scan.next();
        int sum = 0;
        while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        }
        System.out.println(sum);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String w = scan.nextLine();
        String t = scan.next();
        int sum = 0;
        while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        }
        System.out.println(sum);
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String w = scan.nextLine();
        String t = scan.next();
        int sum = 0;
        while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        }
        System.out.println(sum);
    } main {
        Scanner scan = new Scanner(System.in);
        String w = scan.nextLine();
        String t = scan.next();
        int sum = 0;
        while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        }
        System.out.println(sum);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String w = scan.nextLine(); w scan.nextLine() scan.nextLine scan String t = scan.next(); t scan.next() scan.next scan int sum = 0; sum 0 while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        } !t.equals("END_OF_TEXT") t.equals("END_OF_TEXT") t.equals t "END_OF_TEXT" {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        } if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            } t.length() == w.length() t.length() t.length t w.length() w.length w {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            } for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                } int x = 0; int x = 0; x 0 x < t.length() x t.length() t.length t x++ x++ x {
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                } {
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                } if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    } Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x))) Character.toString(t.charAt(x)).equalsIgnoreCase Character.toString(t.charAt(x)) Character.toString Character t.charAt(x) t.charAt t x Character.toString(w.charAt(x)) Character.toString Character w.charAt(x) w.charAt w x {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    } if (x == t.length() - 1) {
                            sum++;
                        } x == t.length() - 1 x t.length() - 1 t.length() t.length t 1 {
                            sum++;
                        } sum++ sum {
                        x = t.length();
                    } x = t.length() x t.length() t.length t t = scan.next() t scan.next() scan.next scan 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){
        Scanner scan = new Scanner(System.in);
        String w = scan.nextLine();
        String t = scan.next();
        int sum = 0;
        while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        }
        System.out.println(sum);
    }
} public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String w = scan.nextLine();
        String t = scan.next();
        int sum = 0;
        while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        }
        System.out.println(sum);
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String w = scan.nextLine();
        String t = scan.next();
        int sum = 0;
        while(!t.equals("END_OF_TEXT")) {
            if (t.length() == w.length()) {
                for (int x = 0; x < t.length(); x++){
                    if (Character.toString(t.charAt(x)).equalsIgnoreCase(Character.toString(w.charAt(x)))) {
                        if (x == t.length() - 1) {
                            sum++;
                        }
                    }
                    else {
                        x = t.length();
                    }
                }
            }
            t = scan.next();
        }
        System.out.println(sum);
    }
}
