const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void async function () {
    // Write your code here
    const str = (await readline()).toLowerCase()
    const target = (await readline()).toLowerCase()
    // 统计次数
    let count = 0
    for(let c of str) {
        if(c === target) {
            count++
        }
    }
    console.log(count)
}()