import java.util.; import java.io.; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = in.readLine().toLowerCase(); String s = in.readLine().toLowerCase(); char[] ch = s.toCharArray(); int num = 0; for(int i = 0;i < str.length();i ++){ if(str.charAt(i) == ch[0]) num ++; } System.out.println(num);
}
}