import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 不区分大小写:全转大写或全转小写 // 输入完整字符串 String str = in.nextLine().toLowerCase(); // 输入单个字符 String str1 = in.nextLine().toLowerCase(); // 将完整字符串中的该字符全部替换为无 String str2 = str.replaceAll(str1,""); // 输出被替换字符长度 System.out.println(str.length() - str2.length()); } }