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
    while ((a = await readline())) {
        b = await readline();
        a = a.toLowerCase();
        b = b.toLowerCase();

        let count = 0;
        for (let index = 0; index < a.length; index++) {
            if (a.slice(index, index + 1) === b) {
                count++;
            }
        }
        console.log(count);
    }
})();