import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s1 = scanner.nextLine();
        String s2 = scanner.nextLine();
        char[] s1List = s1.toLowerCase().toCharArray();
        char[] s2List = s2.toLowerCase().toCharArray();
        int number = 0;
        for (char c : s1List) {
            if (c == s2List[0]) {
                number++;
            }
        }
        System.out.println(number);
    }
}