function Main(input) {
    input = input.split("\n");
    const S = Array.from(input[0])
    const T = input[1]
    const result = S.filter((item, index) => item === T[index]).length;
    console.log(result)
  }
Main(require("fs").readFileSync("/dev/stdin", "utf8"));