function Main(input) {
  input = input.split("\n");
  tmp = input[0].split("");
  real = input[1].split("");
  var answer = 0;
  for(var i=0;i<tmp.length;i++){
    if(tmp[i] === real[i]){
      answer++;
    }
  }
  console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));