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