import java.util.Scanner;

//写出一个程序,接受一个有字母和数字以及空格组成的字符串,和一个字符,然后
//输出输入字符串中含有该字符的个数。不区分大小写。
public class Huaweimachine2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//键盘输入
		Scanner sc=new Scanner(System.in);
		String str=sc.nextLine();
		String ch=sc.nextLine();
		//要做到无视大小写
//		String toUpperCase() 
//        使用默认语言环境的规则将此 String 中的所有字符都转换为大写。 
		String str1=str.toUpperCase();
		String ch1=ch.toUpperCase();
		//拿出这个位置的0索引的字符
//		 char charAt(int index) 
//         返回指定索引处的 char 值。 
		char ch2=ch1.charAt(0);
		     sc.close();
            judge(str1,ch2);
	}
	private static void judge(String str1,char ch2)
	{
//		String[] A=str.split(ch);
//		int len=A.length-1;
//		System.out.println(len);
		//本来想用这种发现,最后计试只有百分之90个通过率,放弃了
		//用遍历的形式
		int count=0;
		for(int i=0;i<str1.length();i++)
		{
		   //当字符串里面有值跟字符相等时
			if(str1.charAt(i) ==ch2)
			{
				count++;
			}
		}
		System.out.println(count);
	}

}