import java.util.Scanner;

public class Main {

public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
    String str = sc.nextLine().toLowerCase();
    String word = sc.nextLine().toLowerCase();
	int result = appearTimes(str,word);
	System.out.println(result);
}

public static int appearTimes(String str,String word) {
	String[] strArray = str.split("");
	int times = 0;
	
	for (String element : strArray) {
		if (word.equals(element)) {
			times ++;
		}
	}
	return times;
}

}