'use strict';
const main = val => {
  const yoho = val[0].trim()
  const res = val[1].trim()
  let ans = 0
  for(let i=0; i<=yoho.length; i++){
    if(yoho[i] === res[i]) ans++
  }
  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));