import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    }
  System.out.println(a);

  }
} import java.io.*; io.* java import java.util.ArrayList; ArrayList java.util public class Main{
	public static void main(String args[]){
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    }
  System.out.println(a);

  }
} Main public static void main(String args[]){
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    }
  System.out.println(a);

  } main {
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    }
  System.out.println(a);

  } int a=0 a 0 end = 0; end 0 String ans; ans BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    } catch(Exception e){
    } Exception e {
    } {
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		} String line = reader.readLine(); line reader.readLine() reader.readLine reader ans = line ans line while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      } true {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      } line = reader.readLine() line reader.readLine() reader.readLine reader for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        } String splitted line.split(" ") line.split line " " {
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        } {
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        } if (ans.equalsIgnoreCase(splitted)) a++; ans.equalsIgnoreCase(splitted) ans.equalsIgnoreCase ans splitted a++ a if (splitted.equals("END_OF_TEXT")) end = 1; splitted.equals("END_OF_TEXT") splitted.equals splitted "END_OF_TEXT" end = 1 end 1 if(end == 1) break; end == 1 end 1 break; System.out.println(a) System.out.println System.out System System.out a String args[] args public class Main{
	public static void main(String args[]){
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    }
  System.out.println(a);

  }
} public class Main{
	public static void main(String args[]){
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    }
  System.out.println(a);

  }
} Main
import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;
      
      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }
      
		}catch(Exception e){
    }
  System.out.println(a);

  }
}
