import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		String W = sc.next();

		int same = 0;

		while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		}

		System.out.println(same);
	}
}
 import java.util.Scanner; Scanner java.util public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		String W = sc.next();

		int same = 0;

		while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		}

		System.out.println(same);
	}
} Main public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		String W = sc.next();

		int same = 0;

		while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		}

		System.out.println(same);
	} main {
		Scanner sc = new Scanner(System.in);

		String W = sc.next();

		int same = 0;

		while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		}

		System.out.println(same);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String W = sc.next(); W sc.next() sc.next sc int same = 0; same 0 while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		} true {
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		} String temp = sc.next(); temp sc.next() sc.next sc if (temp.equals("END_OF_TEXT"))
			{
				break;
			} temp.equals("END_OF_TEXT") temp.equals temp "END_OF_TEXT" {
				break;
			} break; if (temp.equalsIgnoreCase(W))
			{
				same++;
			} temp.equalsIgnoreCase(W) temp.equalsIgnoreCase temp W {
				same++;
			} same++ same System.out.println(same) System.out.println System.out System System.out same String[] args args public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		String W = sc.next();

		int same = 0;

		while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		}

		System.out.println(same);
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		String W = sc.next();

		int same = 0;

		while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		}

		System.out.println(same);
	}
} Main
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		String W = sc.next();

		int same = 0;

		while (true)
		{
			String temp = sc.next();
			if (temp.equals("END_OF_TEXT"))
			{
				break;
			}
			if (temp.equalsIgnoreCase(W))
			{
				same++;
			}
		}

		System.out.println(same);
	}
}

