//先把要查找的字符串以及被查找的字符串都变成小写
let str = readline().toLowerCase();
let findstr = readline().toLowerCase();


function getCodeNum(str,findstr){
    let num = 0,strArr = [...str];
    for (let i of strArr) {
        if(i === findstr){
            num ++;
        }
    }

    return num;
}

console.log(getCodeNum(str,findstr));