let str = readline().toLocaleLowerCase();
let sk = new RegExp(readline(),'gi');
console.log( str.length - str.replace(sk,'').length)