import java.io.*;

public class Main{
	public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int ans = 0;
        try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        }

        System.out.println(ans);
    }
} import java.io.*; io.* java public class Main{
	public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int ans = 0;
        try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int ans = 0;
        try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        }

        System.out.println(ans);
    } main {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int ans = 0;
        try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        }

        System.out.println(ans);
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int ans = 0; ans 0 try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        } catch (IOException e){
            System.out.println(e);
        } IOException e {
            System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        } String W = reader.readLine(); W reader.readLine() reader.readLine reader while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } true {
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } String t = reader.readLine(); t reader.readLine() reader.readLine reader String T = t + ' '; T t + ' ' t ' ' if(t.equals("END_OF_TEXT")) break; t.equals("END_OF_TEXT") t.equals t "END_OF_TEXT" break; for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                } int i = 0; int i = 0; i 0 i < T.length() - W.length() i T.length() - W.length() T.length() T.length T W.length() W.length W i++ i++ i {

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                } {

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                } String S = T.substring(i, i + W.length()); S T.substring(i, i + W.length()) T.substring T i i + W.length() i W.length() W.length W if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    } S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length())) S.equalsIgnoreCase(W) S.equalsIgnoreCase S W Character.isWhitespace(T.charAt(i+W.length())) Character.isWhitespace Character T.charAt(i+W.length()) T.charAt T i+W.length() i W.length() W.length W {
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    } if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        } i - 1 >= 0 i - 1 i 1 0 {
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        } if(!Character.isWhitespace(T.charAt(i-1))) continue; !Character.isWhitespace(T.charAt(i-1)) Character.isWhitespace(T.charAt(i-1)) Character.isWhitespace Character T.charAt(i-1) T.charAt T i-1 i 1 continue; ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int ans = 0;
        try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        }

        System.out.println(ans);
    }
} public class Main{
	public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int ans = 0;
        try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        }

        System.out.println(ans);
    }
} Main
import java.io.*;

public class Main{
	public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int ans = 0;
        try {
            String W = reader.readLine();
            while(true){
                String t = reader.readLine();
                String T = t + ' ';

                if(t.equals("END_OF_TEXT")) break;

                for(int i = 0; i < T.length() - W.length(); i++){

                    String S = T.substring(i, i + W.length());
                    if(S.equalsIgnoreCase(W)&Character.isWhitespace(T.charAt(i+W.length()))){
                        if(i - 1 >= 0){
                            if(!Character.isWhitespace(T.charAt(i-1))) continue;
                        }
                        ans++;
                    }
                }
            } 
        }catch (IOException e){
            System.out.println(e);
        }

        System.out.println(ans);
    }
}
