import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String w, t;
    int count = 0;

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

    System.out.println(count);
    sc.close();
  }
}
 import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String w, t;
    int count = 0;

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

    System.out.println(count);
    sc.close();
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String w, t;
    int count = 0;

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

    System.out.println(count);
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    String w, t;
    int count = 0;

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

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

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

    System.out.println(count);
    sc.close();
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String w, t;
    int count = 0;

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

    System.out.println(count);
    sc.close();
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String w, t;
    int count = 0;

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

    System.out.println(count);
    sc.close();
  }
}

