import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String line = scan.nextLine().toLowerCase();
String[] strs = line.split("");
String target = scan.nextLine().toLowerCase();
int ans = 0;
for (String str : strs) {
if (target.equals(str)) {
ans++;
}
}
System.out.println(ans);
}
}