import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        if(str.length()>500){
           System.out.println("超出字符限制");
           return;
        }
        String strCon=sc.nextLine();
        String lo=str.toLowerCase();
        String con=strCon.toLowerCase();
        System.out.println(lo.length()-lo.replaceAll(con,"").length());    


    }
}