const readline = require('readline');
const rl = readline.createInterface({
    input:process.stdin,
    output:process.stdout
});
let arr = [];
rl.on('line',(line)=>{
    arr.push(line);
})
rl.on('close',()=>{
    let s = arr[0];
    let l = arr[1].toLowerCase();
    let num = 0;
    for(let i of s){
        if(i.toLowerCase() === l){
            num++;
        }
    }
    console.log(num)
})